Browse Source

Cleanup grafana.openstack.org

The opendev.org server is in production, cleanup the old puppet-based
host.

Change-Id: I6db3ce929226a23b96234b52ece8b17f4c6a326a
changes/25/739625/3
Ian Wienand 1 year ago
parent
commit
c49ece9204
  1. 2
      doc/source/grafyaml.rst
  2. 2
      hiera/common.yaml
  3. 7
      inventory/base/hosts.yaml
  4. 6
      inventory/service/groups.yaml
  5. 17
      manifests/site.pp
  6. 1
      modules.env
  7. 102
      modules/openstack_project/manifests/grafana.pp
  8. 16
      modules/openstack_project/templates/grafana.vhost.erb
  9. 2
      playbooks/service-grafana.yaml

2
doc/source/grafyaml.rst

@ -12,7 +12,7 @@ At a Glance
===========
:Hosts:
* http://grafana.openstack.org
* http://grafana.opendev.org
:Puppet:
* https://github.com/pabelanger/puppet-grafyaml
:Configuration:

2
hiera/common.yaml

@ -227,7 +227,7 @@ cacti_hosts:
- gitea06.opendev.org
- gitea07.opendev.org
- gitea08.opendev.org
- grafana.openstack.org
- grafana01.opendev.org
- graphite02.opendev.org
- health.openstack.org
- jvb01.opendev.org

7
inventory/base/hosts.yaml

@ -223,13 +223,6 @@ all:
region_name: sjc1
public_v4: 38.108.68.205
public_v6: 2604:e100:3:0:f816:3eff:feef:a51d
grafana02.openstack.org:
ansible_host: 23.253.253.90
location:
cloud: openstackci-rax
region_name: DFW
public_v4: 23.253.253.90
public_v6: 2001:4800:7817:104:be76:4eff:fe04:60d5
grafana01.opendev.org:
ansible_host: 198.101.251.7
location:

6
inventory/service/groups.yaml

@ -72,8 +72,6 @@ groups:
gitea-lb:
- gitea-lb[0-9]*.opendev.org
grafana:
- grafana[0-9]*.openstack.org
grafana_opendev:
- grafana[0-9]*.opendev.org
graphite:
- graphite*.opendev.org
@ -140,7 +138,6 @@ groups:
- elasticsearch[0-9]*.open*.org
- ethercalc[0-9]*.open*.org
- firehose[0-9]*.open*.org
- grafana[0-9]*.open*.org
- health[0-9]*.openstack.org
- kdc[0-9]*.open*.org
- lists*.katacontainers.io
@ -175,7 +172,6 @@ groups:
- elasticsearch[0-9]*.open*.org
- ethercalc[0-9]*.open*.org
- firehose[0-9]*.open*.org
- grafana[0-9]*.open*.org
- health[0-9]*.openstack.org
- kdc[0-9]*.open*.org
- lists*.katacontainers.io
@ -231,7 +227,7 @@ groups:
- eavesdrop[0-9]*.open*.org
- ethercalc[0-9]*.open*.org
- etherpad[0-9]*.open*.org
- grafana[0-9]*.open*.org
- grafana[0-9].opendev.org
- graphite*.opendev.org
- health[0-9]*.openstack.org
- nb[0-9]*.opendev.org

17
manifests/site.pp

@ -1,20 +1,3 @@
# Node-OS: xenial
# Puppet-Version: !3
node /^grafana\d*\.open.*\.org$/ {
$group = "grafana"
class { 'openstack_project::server': }
class { 'openstack_project::grafana':
admin_password => hiera('grafana_admin_password'),
admin_user => hiera('grafana_admin_user', 'username'),
mysql_host => hiera('grafana_mysql_host', 'localhost'),
mysql_name => hiera('grafana_mysql_name'),
mysql_password => hiera('grafana_mysql_password'),
mysql_user => hiera('grafana_mysql_user', 'username'),
project_config_repo => 'https://opendev.org/openstack/project-config',
secret_key => hiera('grafana_secret_key'),
}
}
# Node-OS: xenial
node /^health\d*\.openstack\.org$/ {
$group = "health"

1
modules.env

@ -56,7 +56,6 @@ SOURCE_MODULES["https://github.com/vamsee/puppet-solr"]="0.0.8"
SOURCE_MODULES["https://github.com/voxpupuli/puppet-alternatives"]="0.3.0"
SOURCE_MODULES["https://github.com/voxpupuli/puppet-archive"]="v0.5.1"
SOURCE_MODULES["https://github.com/voxpupuli/puppet-git_resource"]="0.3.0"
SOURCE_MODULES["https://github.com/voxpupuli/puppet-grafana"]="v6.0.0"
SOURCE_MODULES["https://github.com/voxpupuli/puppet-nodejs"]="v2.3.0"

102
modules/openstack_project/manifests/grafana.pp

@ -1,102 +0,0 @@
# == Class: openstack_project::grafana
#
# === Parameters
# [*cfg*]
# Manages the Grafana configuration file. The upstream puppet-grafana module
# documentaion: https://github.com/bfraser/puppet-grafana#cfg
#
class openstack_project::grafana (
$mysql_password,
$admin_password = '',
$admin_user = 'admin',
$grafana_cfg = {},
$http_host = '127.0.0.1',
$http_port = '8080',
$mysql_host = '127.0.0.1',
$mysql_name = 'grafana',
$mysql_user = 'grafana',
$project_config_repo = '',
$secret_key = '',
$vhost_name = $::fqdn,
) {
include ::httpd
$grafana_cfg_defaults = {
# NOTE(pabelanger): app_mode must be the first key!
'app_mode' => 'production',
'analytics' => {
'reporting_enabled' => false,
},
'auth.anonymous' => {
'enabled' => true,
},
'database' => {
'type' => 'mysql',
'host' => "${mysql_host}:3306",
'name' => $mysql_name,
'user' => $mysql_user,
'password' => $mysql_password,
},
'security' => {
'admin_password' => $admin_password,
'admin_user' => $admin_user,
'secret_key' => $secret_key,
},
'server' => {
'http_addr' => $http_host,
'http_port' => $http_port,
},
'users' => {
'allow_sign_up' => false,
},
}
$grafana_cfg_merged = merge($grafana_cfg_defaults, $grafana_cfg)
$version = 'latest'
class { '::grafana':
cfg => $grafana_cfg_merged,
# Note that we can't use archive because that install_method requires
# the camptocamp-archive module but we have puppetcommunity-archive
# in modules.env, and puppet only supports having one in the modulepath
# at a time.
install_method => 'repo',
version => $version,
}
::httpd::vhost { $vhost_name:
docroot => 'MEANINGLESS ARGUMENT',
port => 80,
priority => '50',
template => 'openstack_project/grafana.vhost.erb',
}
if ! defined(Httpd::Mod['rewrite']) {
httpd::mod { 'rewrite':
ensure => present,
}
}
if ! defined(Httpd::Mod['proxy']) {
httpd::mod { 'proxy':
ensure => present,
}
}
if ! defined(Httpd::Mod['proxy_http']) {
httpd::mod { 'proxy_http':
ensure => present,
}
}
class { '::project_config':
url => $project_config_repo,
}
class { '::grafyaml':
config_dir => $::project_config::grafana_dashboards_dir,
grafana_url => "http://${admin_user}:${admin_password}@${http_host}:${http_port}",
require => Class['grafana'],
}
}

16
modules/openstack_project/templates/grafana.vhost.erb

@ -1,16 +0,0 @@
# ************************************
# Managed by Puppet
# ************************************
NameVirtualHost <%= @vhost_name %>:<%= @port %>
<VirtualHost <%= @vhost_name %>:<%= @port %>>
ServerName <%= @srvname %>
ProxyPass / http://127.0.0.1:8080/ retry=0 nocanon
ProxyPassReverse / http://127.0.0.1:8080/
ErrorLog /var/log/apache2/<%= @name %>_error.log
LogLevel warn
CustomLog /var/log/apache2/<%= @name %>_access.log combined
ServerSignature Off
</VirtualHost>

2
playbooks/service-grafana.yaml

@ -1,4 +1,4 @@
- hosts: "grafana_opendev:!disabled"
- hosts: "grafana:!disabled"
name: "Base: configure grafana"
roles:
- iptables

Loading…
Cancel
Save