Defined Type: scap::dsh::group
- Defined in:
- modules/scap/manifests/dsh/group.pp
Overview
SPDX-License-Identifier: Apache-2.0
define scap::dsh::group
Manages a scap dsh group.
Group entries can be defined either by explicitly providing a host list, or defining scap::dsh::groups::$title in hiera. Also, this can gather all non-inactive nodes from one or more conftool pools.
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 |
# File 'modules/scap/manifests/dsh/group.pp', line 10
define scap::dsh::group(
Optional[Array[Stdlib::Fqdn]] $hosts = undef,
Optional[Array] $conftool = undef,
Optional[String] $pdb_query = undef,
){
if $pdb_query {
$host_list = wmflib::puppetdb_query($pdb_query).map |$x| { $x['certname'] }
} else {
$host_list = $hosts ? {
undef => lookup("scap::dsh::${title}", {'default_value' => []}),
default => $hosts,
}
}
if $conftool {
$default_datacenters = ['eqiad', 'codfw']
# Add the default datacenters if they don't exist
$data = $conftool.map |$x| {
{'datacenters' => $default_datacenters} + $x
}
# And extract the confd keys
$k = $data.map |$datum| {
$datum['datacenters'].map |$y| {
"/${y}/${datum['cluster']}/${datum['service']}"
}
}
$keys = flatten($k)
confd::file { "/etc/dsh/group/${title}":
ensure => present,
prefix => '/pools',
watch_keys => $keys,
content => template('scap/dsh/dsh-group-conftool.tpl.erb')
}
} else {
file { "/etc/dsh/group/${title}":
ensure => present,
owner => 'root',
group => 'root',
mode => '0444',
content => template('scap/dsh/dsh-group.erb'),
}
}
}
|