| 1 |
# this is a Puppet manifest |
| 2 |
# /root/examples/modules1-ntp1.pp |
| 3 |
|
| 4 |
class ntp { |
| 5 |
case $operatingsystem { |
| 6 |
centos, redhat: { |
| 7 |
$service_name = 'ntpd' |
| 8 |
$conf_file = 'ntp.conf.el' |
| 9 |
} |
| 10 |
debian, ubuntu: { |
| 11 |
$service_name = 'ntp' |
| 12 |
$conf_file = 'ntp.conf.debian' |
| 13 |
} |
| 14 |
} |
| 15 |
|
| 16 |
package { 'ntp': |
| 17 |
ensure => installed, |
| 18 |
} |
| 19 |
file { 'ntp.conf': |
| 20 |
path => '/etc/ntp.conf', |
| 21 |
ensure => file, |
| 22 |
require => Package['ntp'], |
| 23 |
source => "/root/examples/answers/${conf_file}" |
| 24 |
} |
| 25 |
service { 'ntp': |
| 26 |
name => $service_name, |
| 27 |
ensure => running, |
| 28 |
enable => true, |
| 29 |
subscribe => File['ntp.conf'], |
| 30 |
} |
| 31 |
} |