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
|
# File 'modules/mediawiki/manifests/mcrouter/yaml_defs.pp', line 5
class mediawiki::mcrouter::yaml_defs(
Stdlib::Unixpath $path = undef,
Stdlib::Port $memcached_notls_port = undef,
Stdlib::Port $memcached_tls_port = undef,
Hash $servers_by_datacenter_category = {},
){
$wancache_pools = $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']
},
}
}
$wikifunctions_pool = $servers_by_datacenter_category['wikifunctions'].map |$dc, $servers| {
{
'name' => "wf-${dc}",
'zone' => $dc,
'servers' => $servers.map |$shard_slot, $address| {
$address['host']
},
}
}
file { $path:
ensure => present,
content => to_yaml(
{'cache' => {'mcrouter' => {
'pools' => $wancache_pools + $wikifunctions_pool,
'memcached_notls_port' => $memcached_notls_port,
'memcached_tls_port' => $memcached_tls_port
}}}
),
owner => 'root',
group => 'root',
mode => '0444',
}
}
|