Puppet Class: profile::scap::dsh

Defined in:
modules/profile/manifests/scap/dsh.pp

Overview

Class profile::scap::dsh

Installs the dsh files used by scap on a host

Parameters:

  • groups (Hash) (defaults to: lookup('scap::dsh::groups'))
  • proxies (Array[Stdlib::Host]) (defaults to: lookup('scap::dsh::scap_proxies', {'default_value' => []}))
  • masters (Array[Stdlib::Host]) (defaults to: lookup('scap::dsh::scap_masters', {'default_value' => []}))
  • conftool_prefix (String) (defaults to: lookup('conftool_prefix'))


4
5
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
# File 'modules/profile/manifests/scap/dsh.pp', line 4

class profile::scap::dsh(
    Hash $groups = lookup('scap::dsh::groups'),
    Array[Stdlib::Host] $proxies = lookup('scap::dsh::scap_proxies', {'default_value' => []}),
    Array[Stdlib::Host] $masters = lookup('scap::dsh::scap_masters', {'default_value' => []}),
    String $conftool_prefix = lookup('conftool_prefix'),
){

    class { 'confd':
        interval => 300,
        prefix   => $conftool_prefix,
        srv_dns  => "${::site}.wmnet",
    }

    $scap_targets = {
        'scap_targets' => {
            'hosts' => (wmflib::class::hosts('mediawiki::scap') + wmflib::resource::hosts('scap::target')).sort.unique,
        },
    }
    class { '::scap::dsh':
        groups       => $groups + $scap_targets,
        scap_proxies => $proxies,
        scap_masters => $masters,
    }

    # Special-case file for the MediaWiki canaries
    # These need to change according to the MediaWiki active datacenter.
    # We also want the servers from each cluster in their own canary list.
    $canary_dcs = ['eqiad', 'codfw']
    $canary_clusters = ['appserver', 'api_appserver', 'jobrunner', 'parsoid']

    $canary_clusters.each |$cl| {
        # Cosmetic fix to get the same filenames as before
        $dsh_name = $cl ? {
            'api_appserver' => 'api',
            default => $cl
        }
        # We also need mediawiki-config to get the active DC.
        $keys = $canary_dcs.map |$dc| { "/pools/${dc}/${cl}/canary" } + '/mediawiki-config'
        confd::file { "/etc/dsh/group/mediawiki-${dsh_name}-canaries":
            ensure     => present,
            content    => template('profile/scap/dsh-mediawiki-canaries.tpl.erb'),
            watch_keys => $keys,
        }
    }
}