From 4bf513c1a0cd1df172d6e4a6ca26e05cf03d450d Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Wed, 21 Oct 2009 12:58:36 +0200 Subject: [PATCH] Make ntp.conf a template --- manifests/site.pp | 3 +- modules/ntp/files/common/client.conf | 21 -------------- .../per-host/ancina.debian.org/client.conf | 19 ------------- modules/ntp/manifests/client.pp | 12 -------- modules/ntp/manifests/init.pp | 28 ++++++++++++++----- modules/ntp/manifests/server.pp | 18 ------------ .../common/server.conf => templates/ntp.conf} | 11 ++++++++ 7 files changed, 33 insertions(+), 79 deletions(-) delete mode 100644 modules/ntp/files/common/client.conf delete mode 100644 modules/ntp/files/per-host/ancina.debian.org/client.conf delete mode 100644 modules/ntp/manifests/client.pp delete mode 100644 modules/ntp/manifests/server.pp rename modules/ntp/{files/common/server.conf => templates/ntp.conf} (74%) diff --git a/manifests/site.pp b/manifests/site.pp index 337f9c57c..b8f396b91 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -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 index 729f2c896..000000000 --- a/modules/ntp/files/common/client.conf +++ /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/per-host/ancina.debian.org/client.conf b/modules/ntp/files/per-host/ancina.debian.org/client.conf deleted file mode 100644 index 486e08727..000000000 --- a/modules/ntp/files/per-host/ancina.debian.org/client.conf +++ /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 index 0882e49d6..000000000 --- a/modules/ntp/manifests/client.pp +++ /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"] - ; - } -} diff --git a/modules/ntp/manifests/init.pp b/modules/ntp/manifests/init.pp index 1b02a8360..f46173556 100644 --- a/modules/ntp/manifests/init.pp +++ b/modules/ntp/manifests/init.pp @@ -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 index ab250f6d1..000000000 --- a/modules/ntp/manifests/server.pp +++ /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/files/common/server.conf b/modules/ntp/templates/ntp.conf similarity index 74% rename from modules/ntp/files/common/server.conf rename to modules/ntp/templates/ntp.conf index 6511b02f3..fdc6d1545 100644 --- a/modules/ntp/files/common/server.conf +++ b/modules/ntp/templates/ntp.conf @@ -10,10 +10,21 @@ 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 -- 2.20.1