X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Fntp%2Fmanifests%2Finit.pp;h=35f0669d076751702aaef4887f83b5b45835894b;hb=555681574b5ccb35e0271515d753961900d7b24b;hp=ace2f8f8dbb886e257aa06668bf33a54b655c124;hpb=78ceca7ca6540a83d24a89016263235c923543db;p=mirror%2Fdsa-puppet.git diff --git a/modules/ntp/manifests/init.pp b/modules/ntp/manifests/init.pp index ace2f8f8d..35f0669d0 100644 --- a/modules/ntp/manifests/init.pp +++ b/modules/ntp/manifests/init.pp @@ -1,33 +1,43 @@ class ntp { - package { ntp: ensure => installed } - 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"] - ; + + package { 'ntp': + ensure => installed } - exec { "ntp restart": - path => "/etc/init.d:/usr/bin:/usr/sbin:/bin:/sbin", - refreshonly => true, + + service { 'ntp': + ensure => running, + require => Package['ntp'] + } + + @ferm::rule { 'dsa-ntp': + domain => '(ip ip6)', + description => 'Allow ntp access', + rule => '&SERVICE(udp, 123)' + } + + file { '/var/lib/ntp': + ensure => directory, + owner => ntp, + group => ntp, + mode => '0755', + require => Package['ntp'] + } + file { '/etc/ntp.conf': + content => template('ntp/ntp.conf'), + notify => Service['ntp'], + require => Package['ntp'], + } + file { '/etc/ntp.keys.d': + ensure => directory, + group => 'ntp', + mode => '0750', + notify => Service['ntp'], + require => Package['ntp'], + } + + if getfromhash($site::nodeinfo, 'timeserver') { + include ntp::timeserver + } else { + include ntp::client } - @ferm::rule { "dsa-ntp": - domain => "(ip ip6)", - description => "Allow ntp access", - rule => "proto udp mod state state (NEW) dport (123) ACCEPT" - } }