All checks were successful
Build / precommit (pull_request) Successful in 3m31s
- modules/libs/lib/facter/pve_nodelist.rb:11:5: W: [Correctable] Lint/RedundantCopDisableDirective: Unnecessary disabling of Metrics/BlockNesting.a - site/profiles/manifests/puppet/puppetboard.pp - WARNING: there should be a single space before '=>' on line 158, column 14 on line 158 (check: space_before_arrow) - site/profiles/manifests/consul/client.pp - WARNING: there should be a single space before '=>' on line 93, column 13 on line 93 (check: space_before_arrow) - site/profiles/manifests/ntp/client.pp - WARNING: there should be a single space before '=>' on line 44, column 16 on line 44 (check: space_before_arrow) - site/profiles/manifests/puppet/enc.pp - WARNING: there should be a single space before '=>' on line 14, column 11 on line 14 (check: space_before_arrow) - site/profiles/manifests/puppet/enc.pp - WARNING: there should be a single space before '=>' on line 18, column 11 on line 18 (check: space_before_arrow) - set max block nesting to 4
49 lines
1.3 KiB
Puppet
49 lines
1.3 KiB
Puppet
# setup an ntp client using chrony
|
|
# use exported resources from profiles::ntp::server if they are available
|
|
class profiles::ntp::client (
|
|
Array $peers,
|
|
Variant[
|
|
String,
|
|
Undef
|
|
] $ntp_role = undef,
|
|
Boolean $wait_enable = true,
|
|
Enum[
|
|
'running',
|
|
'stopped'
|
|
] $wait_ensure = 'running',
|
|
Enum[
|
|
'all',
|
|
'region',
|
|
'country'
|
|
] $use_ntp = 'all',
|
|
Boolean $client_only = true,
|
|
) {
|
|
|
|
# If $client_only, setup a client. Servers are set to false so that they are configured
|
|
# through the profiles::ntp::server class.
|
|
if $client_only {
|
|
|
|
$ntpserver_array = $ntp_role ? {
|
|
undef => $peers,
|
|
default => $use_ntp ? {
|
|
'all' => query_nodes("enc_role='${ntp_role}'", 'networking.fqdn'),
|
|
'region' => query_nodes("enc_role='${ntp_role}' and region=${facts['region']}", 'networking.fqdn'),
|
|
'country' => query_nodes("enc_role='${ntp_role}' and country=${facts['country']}", 'networking.fqdn'),
|
|
}
|
|
}
|
|
|
|
# Define the client configuration based on OS family
|
|
if $facts['os']['family'] == 'RedHat' {
|
|
class { 'chrony':
|
|
servers => sort($ntpserver_array),
|
|
wait_enable => $wait_enable,
|
|
wait_ensure => $wait_ensure,
|
|
}
|
|
} else {
|
|
class { 'chrony':
|
|
servers => sort($ntpserver_array),
|
|
}
|
|
}
|
|
}
|
|
}
|