Added initial version of ntpd module
This commit is contained in:
parent
a7c9df14b8
commit
e75b11402c
3 changed files with 118 additions and 0 deletions
80
ntpd/manifests/init.pp
Normal file
80
ntpd/manifests/init.pp
Normal file
|
@ -0,0 +1,80 @@
|
|||
# Install and configure NTP daemon.
|
||||
#
|
||||
# === Global variables
|
||||
#
|
||||
# $ntp_server:
|
||||
# Array of NTP servers.
|
||||
#
|
||||
class ntpd {
|
||||
|
||||
if !$ntp_server {
|
||||
$ntp_server = ["pool.ntp.org"]
|
||||
}
|
||||
|
||||
case $kernel {
|
||||
linux: {
|
||||
include ntpd::isc-ntpd
|
||||
}
|
||||
openbsd: {
|
||||
include ntpd::openntpd
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
# Install and configure ISC NTP.
|
||||
#
|
||||
class ntpd::isc-ntpd {
|
||||
|
||||
package { "ntp":
|
||||
ensure => installed,
|
||||
}
|
||||
|
||||
file { "/etc/ntp.conf":
|
||||
ensure => present,
|
||||
mode => 0644,
|
||||
owner => root,
|
||||
group => root,
|
||||
content => template("ntpd/ntp.conf.erb"),
|
||||
require => Package["ntp"],
|
||||
notify => Service["ntpd"],
|
||||
}
|
||||
|
||||
service { "ntpd":
|
||||
ensure => running,
|
||||
enable => true,
|
||||
name => $operatingsystem ? {
|
||||
ubuntu => "ntp",
|
||||
debian => "ntp",
|
||||
default => "ntpd",
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
# Install and configure OpenNTPD.
|
||||
#
|
||||
class ntpd::openntpd {
|
||||
|
||||
file { "/etc/ntpd.conf":
|
||||
ensure => present,
|
||||
mode => 0644,
|
||||
owner => root,
|
||||
group => wheel,
|
||||
content => template("ntpd/openntpd.conf.erb"),
|
||||
notify => Service["ntpd"],
|
||||
}
|
||||
|
||||
service { "ntpd":
|
||||
ensure => running,
|
||||
enable => true,
|
||||
binary => "ntpd",
|
||||
start => "ntpd -s",
|
||||
stop => "pkill -u _ntp",
|
||||
status => "pgrep -u _ntp",
|
||||
require => File["/etc/ntpd.conf"],
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue