Puppet Class: mediawiki::mcrouter::yaml_defs

Defined in:
modules/mediawiki/manifests/mcrouter/yaml_defs.pp

Overview

Parameters:

  • path (Stdlib::Unixpath) (defaults to: undef)
  • servers_by_datacenter_category (Hash) (defaults to: {})


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
# File 'modules/mediawiki/manifests/mcrouter/yaml_defs.pp', line 5

class mediawiki::mcrouter::yaml_defs(
    Stdlib::Unixpath $path                 = undef,
    Hash  $servers_by_datacenter_category  = {},
){
    $pools = union(
        $servers_by_datacenter_category['wancache'].map |$datacenter, $servers| {
        {
            'name' => "${datacenter}-servers",
            'zone' => $datacenter,
            'servers' =>  $servers.map |$shard_slot, $address| {
                $address['host']
              },
            'failover' => $servers_by_datacenter_category['gutter'][$datacenter].map |$shard_slot, $address| {
                $address['host']
            },
        }
    },
    # TODO: fix when we switch to TLS
    $servers_by_datacenter_category['proxies'].map |$datacenter, $servers| {
        {
            'name' => "${datacenter}-proxies",
            'zone' => $datacenter,
            'servers' =>  $servers.map |$shard_slot, $address| {
                $address['host']
            },
            'failover' =>  $servers.map |$shard_slot, $address| {
                $address['host']
            },
        }
    }
)
    file { $path:
        ensure  => present,
        content => to_yaml({'mw' => {'mcrouter' => {'pools' => $pools}}}),
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
    }
}