From a9f1289d9711ceb38e4cd285054a9de6016772a6 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Wed, 30 Dec 2009 16:32:54 -0200 Subject: Initial import --- manifests/init.pp | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 manifests/init.pp (limited to 'manifests/init.pp') diff --git a/manifests/init.pp b/manifests/init.pp new file mode 100644 index 0000000..cd745d3 --- /dev/null +++ b/manifests/init.pp @@ -0,0 +1,74 @@ +# This class ensures ntp is up'n running and synchronizing with ntp servers. + +class timezone { + + # the needed packages + package { "tzdata": ensure => installed, } + + # adjusts timezone to brasilian time! + file { "/etc/localtime": + ensure => "/usr/share/zoneinfo/${ntp_timezone}", + require => Package["tzdata"], + } + +} + +class ntp inherits timezone { + # 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"], + } + +} + +class ntpdate inherits timezone { + + # TODO: add logrotate rule to /var/log/ntpdate.log + + # the needed packages + package { "ntpdate": + ensure => present, + } + + # adjust time using ntpdate + cron { "ntpdate": + command => "/usr/sbin/ntpdate -t 5 ${ntp_pool} >> /var/log/ntpdate.log", + user => root, + hour => "*/1", + minute => "10", + ensure => present, + require => Package["ntpdate"], + } + + # ensure ntp service is stopped + service { "ntp": + enable => false, + ensure => false, + } + +} -- cgit v1.2.3