summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-08-20 10:57:34 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-08-20 10:57:34 -0300
commitfdbf15e77aed96b568e1dd42199aaab0b1fd178c (patch)
tree9f6b319608674c1cdab8f5a4cc2ed01d2f9b1858
parent556fc108155ec8e59cf3511d8552d16c8e43e88c (diff)
downloadpuppet-ntp-fdbf15e77aed96b568e1dd42199aaab0b1fd178c.tar.gz
puppet-ntp-fdbf15e77aed96b568e1dd42199aaab0b1fd178c.tar.bz2
Splitting and renaming classes for autoloading
-rw-r--r--manifests/init.pp50
-rw-r--r--manifests/ntpdate.pp26
-rw-r--r--manifests/timezone.pp17
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"],
+ }
+}