1
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
|
# This class ensures ntp is up'n running and synchronizing with ntp servers.
class ntp(
$servers = hiera('ntp::servers', '')
) {
class { 'ntp::timezone': }
case $servers {
'': { fail("you need to define ntp::servers for ntp module") }
}
# the needed packages
package { "ntp": ensure => installed, }
# ntp service
service { "ntp":
enable => true,
ensure => running,
hasrestart => true,
require => [ Package["ntp"], File["/etc/ntp.drift"], File["/etc/ntp.conf"] ],
}
# the /etc/ntp.drift file contains the latest estimate of clock frequency
# error.
file { "/etc/ntp.drift":
owner => "root",
group => "root",
mode => 0644,
ensure => present,
}
# ntp configuration file
file { "/etc/ntp.conf":
content => template('ntp/ntp.conf.erb'),
owner => "root",
group => "root",
mode => 0644,
ensure => present,
notify => Service["ntp"],
}
}
|