Puppet Class: profile::grafana::production

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

Overview

SPDX-License-Identifier: Apache-2.0

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'))


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
# File 'modules/profile/manifests/grafana/production.pp', line 7

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.
    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',
        chown               => 'grafana:grafana',
    }

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

    class {'::profile::grafana::datasource_exporter':
        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.
    grafana::datasources { 'production-datasources':
        source => 'puppet:///modules/profile/grafana/production-datasources.yaml',
    }

    grafana::dashboard { 'varnish-aggregate-client-status-codes':
        ensure  => 'absent',
        content => ''
    }

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