Puppet Class: ntp::config
- Inherits:
- ntp
- Defined in:
- manifests/config.pp
Overview
Private Class
2 3 4 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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'manifests/config.pp', line 2
class ntp::config inherits ntp {
#The servers-netconfig file overrides NTP config on SLES 12, interfering with our configuration.
if $facts['operatingsystem'] == 'SLES' and $facts['operatingsystemmajrelease'] == '12' {
file { '/var/run/ntp/servers-netconfig':
ensure => 'absent'
}
}
if $ntp::keys_enable {
case $ntp::config_dir {
'/', '/etc', undef: {}
default: {
file { $ntp::config_dir:
ensure => directory,
owner => 0,
group => 0,
mode => '0775',
recurse => false,
}
}
}
file { $ntp::keys_file:
ensure => file,
owner => 0,
group => 0,
mode => '0644',
content => epp('ntp/keys.epp'),
}
}
#If both epp and erb are defined, throw validation error.
#Otherwise use the defined erb/epp template, or use default
if $ntp::config_epp and $ntp::config_template {
fail('Cannot supply both config_epp and config_template templates for ntp config file.')
}elsif $ntp::config_template {
$config_content = template($ntp::config_template)
}elsif $ntp::config_epp {
$config_content = epp($ntp::config_epp)
}else {
$config_content = epp('ntp/ntp.conf.epp')
}
file { $ntp::config:
ensure => file,
owner => 0,
group => 0,
mode => $::ntp::config_file_mode,
content => $config_content,
}
#If both epp and erb are defined, throw validation error.
#Otherwise use the defined erb/epp template, or use default
if $::ntp::step_tickers_file {
if $::ntp::step_tickers_template and $::ntp::step_tickers_epp {
fail('Cannot supply both step_tickers_file and step_tickers_epp templates for step ticker file')
} elsif $::ntp::step_tickers_template {
$step_ticker_content = template($ntp::step_tickers_template)
} elsif $::ntp::step_tickers_epp {
$step_ticker_content = epp($::ntp::step_tickers_epp)
} else{
$step_ticker_content = epp('ntp/step-tickers.epp')
}
file { $::ntp::step_tickers_file:
ensure => file,
owner => 0,
group => 0,
mode => $::ntp::config_file_mode,
content => $step_ticker_content,
}
}
if $ntp::logfile {
file { $ntp::logfile:
ensure => file,
owner => 'ntp',
group => 'ntp',
mode => '0664',
}
}
if $ntp::disable_dhclient {
augeas { 'disable ntp-servers in dhclient.conf':
context => '/files/etc/dhcp/dhclient.conf',
changes => 'rm request/*[.="ntp-servers"]',
}
file { '/var/lib/ntp/ntp.conf.dhcp':
ensure => absent,
}
}
}
|