]> git.donarmstrong.com Git - dsa-puppet.git/commitdiff
Make ntp.conf a template
authorPeter Palfrader <peter@palfrader.org>
Wed, 21 Oct 2009 10:58:36 +0000 (12:58 +0200)
committerPeter Palfrader <peter@palfrader.org>
Wed, 21 Oct 2009 10:58:36 +0000 (12:58 +0200)
manifests/site.pp
modules/ntp/files/common/client.conf [deleted file]
modules/ntp/files/common/server.conf [deleted file]
modules/ntp/files/per-host/ancina.debian.org/client.conf [deleted file]
modules/ntp/manifests/client.pp [deleted file]
modules/ntp/manifests/init.pp
modules/ntp/manifests/server.pp [deleted file]
modules/ntp/templates/ntp.conf [new file with mode: 0644]

index 337f9c57c89d50ef31c2b264446f064898065a60..b8f396b91d4a574f0050bcbdd0a63fb6015ad0f8 100644 (file)
@@ -22,6 +22,7 @@ node default {
     include debian-org
     include monit
     include apt-keys
+    include ntp
 
     include motd
     include samhain
@@ -77,10 +78,8 @@ node default {
          geo1,geo2,geo3:
                     {
                       include named::geodns
-                      include ntp::server
                     }
          default:   {
-                      include ntp::client
                     }
      }
      case $brokenhosts {
diff --git a/modules/ntp/files/common/client.conf b/modules/ntp/files/common/client.conf
deleted file mode 100644 (file)
index 729f2c8..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-##
-## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
-## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
-##
-
-driftfile /var/lib/ntp/ntp.drift
-statsdir /var/log/ntpstats/
-
-statistics loopstats peerstats clockstats
-filegen loopstats file loopstats type day enable
-filegen peerstats file peerstats type day enable
-filegen clockstats file clockstats type day enable
-server geo1.debian.org iburst dynamic
-server geo2.debian.org iburst dynamic
-server geo3.debian.org iburst dynamic
-
-restrict -4 default kod notrap nomodify nopeer noquery
-restrict -6 default kod notrap nomodify nopeer noquery
-
-restrict 127.0.0.1
-restrict ::1
diff --git a/modules/ntp/files/common/server.conf b/modules/ntp/files/common/server.conf
deleted file mode 100644 (file)
index 6511b02..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-##
-## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
-## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
-##
-
-driftfile /var/lib/ntp/ntp.drift
-statsdir /var/log/ntpstats/
-
-statistics loopstats peerstats clockstats
-filegen loopstats file loopstats type day enable
-filegen peerstats file peerstats type day enable
-filegen clockstats file clockstats type day enable
-server 0.debian.pool.ntp.org iburst dynamic
-server 1.debian.pool.ntp.org iburst dynamic
-server 2.debian.pool.ntp.org iburst dynamic
-server 3.debian.pool.ntp.org iburst dynamic
-
-restrict -4 default kod notrap nomodify nopeer noquery
-restrict -6 default kod notrap nomodify nopeer noquery
-
-restrict 127.0.0.1
-restrict ::1
diff --git a/modules/ntp/files/per-host/ancina.debian.org/client.conf b/modules/ntp/files/per-host/ancina.debian.org/client.conf
deleted file mode 100644 (file)
index 486e087..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-##
-## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
-## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
-##
-
-driftfile /var/lib/ntp/ntp.drift
-statsdir /var/log/ntpstats/
-
-statistics loopstats peerstats clockstats
-filegen loopstats file loopstats type day enable
-filegen peerstats file peerstats type day enable
-filegen clockstats file clockstats type day enable
-server ntp.ugent.be iburst dynamic
-
-restrict -4 default kod notrap nomodify nopeer noquery
-restrict -6 default kod notrap nomodify nopeer noquery
-
-restrict 127.0.0.1
-restrict ::1
diff --git a/modules/ntp/manifests/client.pp b/modules/ntp/manifests/client.pp
deleted file mode 100644 (file)
index 0882e49..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-class ntp::client inherits ntp {
-       file { "/etc/ntp.conf":
-               owner   => root,
-               group   => root,
-               mode    => 444,
-               source  => [ "puppet:///ntp/per-host/$fqdn/client.conf",
-                            "puppet:///ntp/common/client.conf" ],
-               notify  => Exec["ntp restart"],
-               require => Package["ntp"]
-               ;
-       }
-}
index 1b02a836050c2e00d1abaf5a04b1eed70de32f2d..f46173556ee23ee64a7ba28566ed31d4d6c02ebc 100644 (file)
@@ -1,14 +1,28 @@
 class ntp {
        package { ntp: ensure => installed }
-       file { "/var/lib/ntp/":
-               ensure  => directory,
-               owner   => ntp,
-               group   => ntp,
-               mode    => 755
-               ;
+       file {  "/var/lib/ntp/":
+                       ensure  => directory,
+                       owner   => ntp,
+                       group   => ntp,
+                       mode    => 755
+                       ;
+               "/var/lib/ntpstats":
+                       ensure  => directory,
+                       owner   => ntp,
+                       group   => ntp,
+                       mode    => 755
+                       ;
+               "/etc/ntp.conf":
+                       owner   => root,
+                       group   => root,
+                       mode    => 444,
+                       content => template("ntp/ntp.conf"),
+                       notify  => Exec["ntp restart"],
+                       require => Package["ntp"]
+                       ;
        }
        exec { "ntp restart":
-               path        => "/etc/init.d:/usr/bin:/usr/sbin:/bin:/sbin",
+               path        => "/etc/init.d:/usr/bin:/usr/sbin:/bin:/sbin",
                refreshonly => true,
        }
 }
diff --git a/modules/ntp/manifests/server.pp b/modules/ntp/manifests/server.pp
deleted file mode 100644 (file)
index ab250f6..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-class ntp::server inherits ntp {
-       file { "/etc/ntp.conf":
-               owner   => root,
-               group   => root,
-               mode    => 444,
-               source  => [ "puppet:///ntp/per-host/$fqdn/server.conf",
-                            "puppet:///ntp/common/server.conf" ],
-               notify  => Exec["ntp restart"],
-               require => Package["ntp"]
-               ;
-               "/var/lib/ntpstats":
-               ensure  => directory,
-               owner   => ntp,
-               group   => ntp,
-               mode    => 755
-               ;
-       }
-}
diff --git a/modules/ntp/templates/ntp.conf b/modules/ntp/templates/ntp.conf
new file mode 100644 (file)
index 0000000..fdc6d15
--- /dev/null
@@ -0,0 +1,33 @@
+##
+## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
+## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
+##
+
+driftfile /var/lib/ntp/ntp.drift
+statsdir /var/log/ntpstats/
+
+statistics loopstats peerstats clockstats
+filegen loopstats file loopstats type day enable
+filegen peerstats file peerstats type day enable
+filegen clockstats file clockstats type day enable
+
+<% case fqdn
+       when /geo[123].debian.org/:
+-%>
+server 0.debian.pool.ntp.org iburst dynamic
+server 1.debian.pool.ntp.org iburst dynamic
+server 2.debian.pool.ntp.org iburst dynamic
+server 3.debian.pool.ntp.org iburst dynamic
+<%     when "ancina.debian.org/": -%>
+server ntp.ugent.be iburst dynamic
+<%     else -%>
+server geo1.debian.org iburst dynamic
+server geo2.debian.org iburst dynamic
+server geo3.debian.org iburst dynamic
+<% end -%>
+
+restrict -4 default kod notrap nomodify nopeer noquery
+restrict -6 default kod notrap nomodify nopeer noquery
+
+restrict 127.0.0.1
+restrict ::1