summaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2009-12-30 16:32:54 -0200
committerSilvio Rhatto <rhatto@riseup.net>2009-12-30 16:32:54 -0200
commita9f1289d9711ceb38e4cd285054a9de6016772a6 (patch)
tree12ddab27c62310130e8506bab4603362e13e0e05 /manifests
downloadpuppet-ntp-a9f1289d9711ceb38e4cd285054a9de6016772a6.tar.gz
puppet-ntp-a9f1289d9711ceb38e4cd285054a9de6016772a6.tar.bz2
Initial import
Diffstat (limited to 'manifests')
-rw-r--r--manifests/init.pp74
1 files changed, 74 insertions, 0 deletions
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,
+ }
+
+}