diff options
author | Leif Johansson <leifj@sunet.se> | 2014-06-30 11:49:48 +0200 |
---|---|---|
committer | Leif Johansson <leifj@sunet.se> | 2014-06-30 11:49:48 +0200 |
commit | deff549e038885729868b30c68a12538883c9646 (patch) | |
tree | 26e7ff03a8baf9e3bfd2fff5edb90e23ba7a1dc5 /global/overlay/etc/puppet/modules/sunet/manifests/server.pp | |
parent | a1bc104e5bd63ab896afc92781df6aac6efd90e3 (diff) | |
parent | ecb417e8ce9a1eca586e2169c615c2bd30c938f8 (diff) |
Merge branch 'master' of git.nordu.net:sunet-opssunet-ops-2014-06-30-v02
Diffstat (limited to 'global/overlay/etc/puppet/modules/sunet/manifests/server.pp')
-rw-r--r-- | global/overlay/etc/puppet/modules/sunet/manifests/server.pp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/global/overlay/etc/puppet/modules/sunet/manifests/server.pp b/global/overlay/etc/puppet/modules/sunet/manifests/server.pp index 875dc69..14df323 100644 --- a/global/overlay/etc/puppet/modules/sunet/manifests/server.pp +++ b/global/overlay/etc/puppet/modules/sunet/manifests/server.pp @@ -37,4 +37,51 @@ define sunet::server() { notify => Service['ssh'], } + # already declared in puppet-cosmos/manifests/ntp.pp + #service { 'ntp': + # ensure => 'running', + #} + + # Don't use pool.ntp.org servers, but rather DHCP provided NTP servers + line { 'no_pool_ntp_org_servers': + file => '/etc/ntp.conf', + line => '^server .*\.pool\.ntp\.org', + ensure => 'comment', + notify => Service['ntp'], + } + + file { '/var/cache/scriptherder': + ensure => 'directory', + path => '/var/cache/scriptherder', + mode => '1777', # like /tmp, so user-cronjobs can also use scriptherder + } + + +} + +# from http://projects.puppetlabs.com/projects/puppet/wiki/Simple_Text_Patterns/5 +define line($file, $line, $ensure = 'present') { + case $ensure { + default : { err ( "unknown ensure value ${ensure}" ) } + present: { + exec { "/bin/echo '${line}' >> '${file}'": + unless => "/bin/grep -qFx '${line}' '${file}'" + } + } + absent: { + exec { "/usr/bin/perl -ni -e 'print unless /^\\Q${line}\\E\$/' '${file}'": + onlyif => "/bin/grep -qFx '${line}' '${file}'" + } + } + uncomment: { + exec { "/bin/sed -i -e'/${line}/s/^#\\+//' '${file}'": + onlyif => "/bin/grep '${line}' '${file}' | /bin/grep '^#' | /usr/bin/wc -l" + } + } + comment: { + exec { "/bin/sed -i -e'/${line}/s/^\\(.\\+\\)$/#\\1/' '${file}'": + onlyif => "/usr/bin/test `/bin/grep '${line}' '${file}' | /bin/grep -v '^#' | /usr/bin/wc -l` -ne 0" + } + } + } } |