]> gitweb.fluxo.info Git - puppet-ntp.git/commitdiff
Splitting and renaming classes for autoloading
authorSilvio Rhatto <rhatto@riseup.net>
Wed, 20 Aug 2014 13:57:34 +0000 (10:57 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Wed, 20 Aug 2014 13:57:34 +0000 (10:57 -0300)
manifests/init.pp
manifests/ntpdate.pp [new file with mode: 0644]
manifests/timezone.pp [new file with mode: 0644]

index a980efba5dadf9cec0a86d2e5024ae906ede628a..40d8fc40e49d7647bc9d2bfd6ff064ce963e097b 100644 (file)
@@ -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 (file)
index 0000000..ed858ba
--- /dev/null
@@ -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 (file)
index 0000000..a54676b
--- /dev/null
@@ -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"],
+  }
+}