summaryrefslogtreecommitdiff
path: root/manifests/init.pp
diff options
context:
space:
mode:
Diffstat (limited to 'manifests/init.pp')
-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,
+ }
+
+}