From d656940e8a36439fa782a2f2966087d5cbebd66c Mon Sep 17 00:00:00 2001 From: Stephen Gran Date: Tue, 13 Oct 2009 22:20:38 +0100 Subject: [PATCH] add ntp module Signed-off-by: Stephen Gran --- manifests/site.pp | 8 ++++++-- modules/debian-org/manifests/init.pp | 1 - modules/ntp/files/client.conf | 21 +++++++++++++++++++++ modules/ntp/files/server.conf | 22 ++++++++++++++++++++++ modules/ntp/manifests/client.pp | 11 +++++++++++ modules/ntp/manifests/init.pp | 14 ++++++++++++++ modules/ntp/manifests/server.pp | 17 +++++++++++++++++ 7 files changed, 91 insertions(+), 3 deletions(-) create mode 100644 modules/ntp/files/client.conf create mode 100644 modules/ntp/files/server.conf create mode 100644 modules/ntp/manifests/client.pp create mode 100644 modules/ntp/manifests/init.pp create mode 100644 modules/ntp/manifests/server.pp diff --git a/manifests/site.pp b/manifests/site.pp index af7c23d9c..856696f93 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -75,8 +75,12 @@ node default { case $hostname { geo1,geo2,geo3: - { include geodns } - default: {} + { + include geodns + include ntp::server + } + default: { + } } case $brokenhosts { "true": { include hosts } diff --git a/modules/debian-org/manifests/init.pp b/modules/debian-org/manifests/init.pp index d56db42ad..4dca10d0c 100644 --- a/modules/debian-org/manifests/init.pp +++ b/modules/debian-org/manifests/init.pp @@ -25,7 +25,6 @@ class debian-org { "pdksh": ensure => installed; "ksh": ensure => installed; "csh": ensure => installed; - "ntp": ensure => installed; "locales-all": ensure => installed; "libpam-pwdfile": ensure => installed; "vim": ensure => installed; diff --git a/modules/ntp/files/client.conf b/modules/ntp/files/client.conf new file mode 100644 index 000000000..729f2c896 --- /dev/null +++ b/modules/ntp/files/client.conf @@ -0,0 +1,21 @@ +## +## 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/server.conf b/modules/ntp/files/server.conf new file mode 100644 index 000000000..6511b02f3 --- /dev/null +++ b/modules/ntp/files/server.conf @@ -0,0 +1,22 @@ +## +## 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/manifests/client.pp b/modules/ntp/manifests/client.pp new file mode 100644 index 000000000..cc6964b55 --- /dev/null +++ b/modules/ntp/manifests/client.pp @@ -0,0 +1,11 @@ +class ntp::client inherits ntp { + file { "/etc/ntp.conf": + owner => root, + group => root, + mode => 440, + source => [ "puppet:///ntp/client.conf" ], + notify => Exec["ntp restart"], + require => Package["ntp"] + ; + } +} diff --git a/modules/ntp/manifests/init.pp b/modules/ntp/manifests/init.pp new file mode 100644 index 000000000..1b02a8360 --- /dev/null +++ b/modules/ntp/manifests/init.pp @@ -0,0 +1,14 @@ +class ntp { + package { ntp: ensure => installed } + file { "/var/lib/ntp/": + ensure => directory, + owner => ntp, + group => ntp, + mode => 755 + ; + } + exec { "ntp restart": + 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 new file mode 100644 index 000000000..cc5b3dcba --- /dev/null +++ b/modules/ntp/manifests/server.pp @@ -0,0 +1,17 @@ +class ntp::server inherits ntp { + file { "/etc/ntp.conf": + owner => root, + group => root, + mode => 440, + source => [ "puppet:///ntp/server.conf" ], + notify => Exec["ntp restart"], + require => Package["ntp"] + ; + "/var/lib/ntpstats": + ensure => directory, + owner => ntp, + group => ntp, + mode => 755 + ; + } +} -- 2.20.1