diff options
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/init.pp | 50 | ||||
-rw-r--r-- | manifests/ntpdate.pp | 26 | ||||
-rw-r--r-- | manifests/timezone.pp | 17 |
3 files changed, 44 insertions, 49 deletions
diff --git a/manifests/init.pp b/manifests/init.pp index a980efb..40d8fc4 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,27 +1,8 @@ # This class ensures ntp is up'n running and synchronizing with ntp servers. - -class timezone( - $zone = hiera('ntp::zone', '') -) { - - case $zone { - '': { fail("you need to define ntp::zone for ntp module") } - } - - # the needed packages - package { "tzdata": ensure => installed, } - - # adjust localtime - file { "/etc/localtime": - ensure => "/usr/share/zoneinfo/${zone}", - require => Package["tzdata"], - } -} - class ntp( $servers = hiera('ntp::servers', '') ) { - class { 'timezone': } + class { 'ntp::timezone': } case $servers { '': { fail("you need to define ntp::servers for ntp module") } @@ -56,33 +37,4 @@ class ntp( ensure => present, notify => Service["ntp"], } - -} - -class ntpdate( - $pool = hiera('ntp::pool', '') -) { - class { 'timezone': } - - # TODO: add logrotate rule to /var/log/ntpdate.log - - case $pool { - '': { fail("you need to define ntp::pool for ntp module") } - } - - # the needed packages - package { "ntpdate": - ensure => present, - } - - # adjust time using ntpdate - cron { "ntpdate": - command => "/usr/sbin/ntpdate -t 5 ${pool} >> /var/log/ntpdate.log 2>&1", - user => root, - hour => "*/1", - minute => "10", - ensure => present, - require => Package["ntpdate"], - } - } diff --git a/manifests/ntpdate.pp b/manifests/ntpdate.pp new file mode 100644 index 0000000..ed858ba --- /dev/null +++ b/manifests/ntpdate.pp @@ -0,0 +1,26 @@ +class ntp::ntpdate( + $pool = hiera('ntp::pool', '') +) { + class { 'ntp::timezone': } + + # TODO: add logrotate rule to /var/log/ntpdate.log + + case $pool { + '': { fail("you need to define ntp::pool for ntp module") } + } + + # the needed packages + package { "ntpdate": + ensure => present, + } + + # adjust time using ntpdate + cron { "ntpdate": + command => "/usr/sbin/ntpdate -t 5 ${pool} >> /var/log/ntpdate.log 2>&1", + user => root, + hour => "*/1", + minute => "10", + ensure => present, + require => Package["ntpdate"], + } +} diff --git a/manifests/timezone.pp b/manifests/timezone.pp new file mode 100644 index 0000000..a54676b --- /dev/null +++ b/manifests/timezone.pp @@ -0,0 +1,17 @@ +class ntp::timezone( + $zone = hiera('ntp::zone', '') +) { + + case $zone { + '': { fail("you need to define ntp::zone for ntp module") } + } + + # the needed packages + package { "tzdata": ensure => installed, } + + # adjust localtime + file { "/etc/localtime": + ensure => "/usr/share/zoneinfo/${zone}", + require => Package["tzdata"], + } +} |