chore: reorganise ntp server

- bump enc to match changes
- change ntp client to find servers through puppetdb query
- changed default ntp servers to publicly available nodes
This commit is contained in:
2023-11-18 18:25:44 +11:00
parent bae3d446b6
commit dffc97ad4c
6 changed files with 21 additions and 7 deletions
+13 -2
View File
@@ -2,6 +2,10 @@
# 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',
@@ -14,16 +18,23 @@ class profiles::ntp::client (
# through the profiles::ntp::server class.
if $client_only {
# if ntp_role is set, find all hosts matching that enc_role
if $ntp_role == undef {
$ntpserver_array = $peers
}else{
$ntpserver_array = query_nodes("enc_role='${ntp_role}'", 'networking.fqdn')
}
# Define the client configuration based on OS family
if $facts['os']['family'] == 'RedHat' {
class { 'chrony':
servers => $peers,
servers => $ntpserver_array,
wait_enable => $wait_enable,
wait_ensure => $wait_ensure,
}
} else {
class { 'chrony':
servers => $peers,
servers => $ntpserver_array,
}
}
}
+1 -1
View File
@@ -19,7 +19,7 @@ class profiles::ntp::server (
# check the enc_role has been set, it can take two puppet runs to do this
# TODO: change away from external fact
if $facts['enc_role'] == 'roles::infra::ntpserver' {
if $facts['enc_role'] == 'roles::infra::ntp::server' {
# define the server
if $facts['os']['family'] == 'RedHat' {