Puppet Class: profile::grafana::production

Defined in:
modules/profile/manifests/grafana/production.pp

Overview

Class: profile::grafana::production

Grafana is a dashboarding web application. It powers <grafana.wikimedia.org>.

Parameters:

  • active_host (Stdlib::Fqdn) (defaults to: lookup('profile::grafana::active_host'))
  • standby_host (Stdlib::Fqdn) (defaults to: lookup('profile::grafana::standby_host'))


6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'modules/profile/manifests/grafana/production.pp', line 6

class profile::grafana::production (
    Stdlib::Fqdn $active_host = lookup('profile::grafana::active_host'),
    Stdlib::Fqdn $standby_host = lookup('profile::grafana::standby_host'),
) {
    include ::profile::grafana
    include ::profile::grafana::grizzly

    $on_active_host = $active_host == $::fqdn ? {
        true  => present,
        false => absent,
    }

    # Enables rsync'ing /var/lib/grafana from active host to standby host.
    # Set ensure => absent to disable the rsync job.
    rsync::quickdatacopy { 'var-lib-grafana':
      ensure              => present,
      source_host         => $active_host,
      dest_host           => $standby_host,
      module_path         => '/var/lib/grafana',
      server_uses_stunnel => true,
      exclude             => 'grafana.db-journal',
    }

    class {'::grafana::ldap_sync':
        ensure => $on_active_host,
    }

    # On Grafana 5 and later, datasource configurations are stored in Puppet
    # as YAML and pushed to Grafana that way, which reads them at startup.
    file { '/etc/grafana/provisioning/datasources/production-datasources.yaml':
        ensure  => present,
        source  => 'puppet:///modules/profile/grafana/production-datasources.yaml',
        owner   => 'root',
        group   => 'grafana',
        mode    => '0440',
        require => Package['grafana'],
        notify  => Service['grafana-server'],
    }

    grafana::dashboard { 'varnish-http-errors':
        ensure  => absent,
        content => '',
    }

    grafana::dashboard { 'varnish-aggregate-client-status-codes':
        source => 'puppet:///modules/grafana/dashboards/varnish-aggregate-client-status-codes',
    }

    grafana::dashboard { 'swift':
        source => 'puppet:///modules/grafana/dashboards/swift',
    }
}