diff options
-rw-r--r-- | files/.git_placeholder | 1 | ||||
-rw-r--r-- | files/cron.d/puppetd | 2 | ||||
-rw-r--r-- | files/cron.d/puppetd.CentOS | 2 | ||||
-rw-r--r-- | files/cron.d/puppetd.Gentoo | 2 | ||||
-rw-r--r--[l---------] | files/cron.d/puppetmaster | 3 | ||||
-rw-r--r-- | manifests/init.pp | 2 | ||||
-rw-r--r-- | manifests/puppetmaster.pp | 24 | ||||
-rw-r--r-- | manifests/puppetmaster/centos.pp | 12 | ||||
-rw-r--r-- | manifests/puppetmaster/linux.pp | 14 | ||||
-rw-r--r-- | manifests/puppetmaster/package.pp | 9 |
10 files changed, 44 insertions, 27 deletions
diff --git a/files/.git_placeholder b/files/.git_placeholder deleted file mode 100644 index 89cb1fe..0000000 --- a/files/.git_placeholder +++ /dev/null @@ -1 +0,0 @@ -# file needed for git - don't remove it diff --git a/files/cron.d/puppetd b/files/cron.d/puppetd index a4b19ac..7f66b29 100644 --- a/files/cron.d/puppetd +++ b/files/cron.d/puppetd @@ -1,4 +1,4 @@ # check if puppet is running -0 * * * * root /bin/ps ax | /bin/grep -v grep | /bin/grep puppetd > /dev/null || /etc/init.d/puppet restart +0 * * * * root /bin/ps ax | /bin/grep -v grep | /bin/grep -q puppetd || (sleep `echo $RANDOM/2000*60 | bc` && /etc/init.d/puppet restart) # restart puppet once in a while and randomly delay the restart between 0 and 32 minutes -> splay puppetmaster hammering 0 22 * * */2 root sleep `echo $RANDOM/1000*60 | bc` && /etc/init.d/puppet restart > /dev/null diff --git a/files/cron.d/puppetd.CentOS b/files/cron.d/puppetd.CentOS index a4b19ac..21fa439 100644 --- a/files/cron.d/puppetd.CentOS +++ b/files/cron.d/puppetd.CentOS @@ -1,4 +1,4 @@ # check if puppet is running -0 * * * * root /bin/ps ax | /bin/grep -v grep | /bin/grep puppetd > /dev/null || /etc/init.d/puppet restart +0 * * * * root /etc/init.d/puppet status > /dev/null || (sleep `echo $RANDOM/2000*60 | bc` && /etc/init.d/puppet restart) # restart puppet once in a while and randomly delay the restart between 0 and 32 minutes -> splay puppetmaster hammering 0 22 * * */2 root sleep `echo $RANDOM/1000*60 | bc` && /etc/init.d/puppet restart > /dev/null diff --git a/files/cron.d/puppetd.Gentoo b/files/cron.d/puppetd.Gentoo index 4f0db3c..68361f0 100644 --- a/files/cron.d/puppetd.Gentoo +++ b/files/cron.d/puppetd.Gentoo @@ -1,4 +1,4 @@ # check if puppet is running -# 0 * * * * root /bin/ps ax | /bin/grep -v grep | /bin/grep puppetd > /dev/null || /etc/init.d/puppet restart +# 0 * * * * root /bin/ps ax | /bin/grep -v grep | /bin/grep -q puppetd || ( sleep `echo $RANDOM/2000*60 | bc` && /etc/init.d/puppet restart ) # restart puppet once in a while and randomly delay the restart between 0 and 32 minutes -> splay puppetmaster hammering # 0 22 * * */2 root sleep `echo $RANDOM/1000*60 | bc` && /etc/init.d/puppet restart > /dev/null diff --git a/files/cron.d/puppetmaster b/files/cron.d/puppetmaster index 7e5177a..40a16e7 120000..100644 --- a/files/cron.d/puppetmaster +++ b/files/cron.d/puppetmaster @@ -1 +1,2 @@ -puppetmaster.CentOS
\ No newline at end of file +# we restart puppetmaster every 4 hours to avoid memory problems +0 */6 * * * root /etc/init.d/puppetmaster restart > /dev/null diff --git a/manifests/init.pp b/manifests/init.pp index 3454856..efa263a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -88,9 +88,11 @@ class puppet::debian inherits puppet::linux { hasstatus => false, } } + class puppet::centos inherits puppet::linux { file{'/etc/sysconfig/puppet': source => [ "puppet://$server/files/puppet/sysconfig/${fqdn}/puppet", + "puppet://$server/files/puppet/sysconfig/${domain}/puppet", "puppet://$server/files/puppet/sysconfig/puppet", "puppet://$server/puppet/sysconfig/puppet" ], notify => Service[puppet], diff --git a/manifests/puppetmaster.pp b/manifests/puppetmaster.pp index dd0f800..4470a84 100644 --- a/manifests/puppetmaster.pp +++ b/manifests/puppetmaster.pp @@ -4,7 +4,8 @@ import "storeconfigs.pp" class puppet::puppetmaster inherits puppet { case $operatingsystem { - centos,debian, redhat: { include puppet::puppetmaster::package } + debian: { include puppet::puppetmaster::package } + centos: { include puppet::puppetmaster::centos } default: { case $kernel { linux: { include puppet::puppetmaster::linux } @@ -43,27 +44,6 @@ class puppet::puppetmaster inherits puppet { } } -class puppet::puppetmaster::linux inherits puppet::linux { - - service{'puppetmaster': - ensure => running, - enable => true, - require => [ Package[puppet] ], - } - - Service[puppet]{ - require +> Service[puppetmaster], - } -} - -class puppet::puppetmaster::package inherits puppet::puppetmaster::linux { - package { puppet-server: ensure => present } - - Service[puppetmaster]{ - require +> Package[puppet-server], - } -} - define puppet::puppetmaster::hasdb( $dbtype = 'mysql', $dbname = 'puppet', diff --git a/manifests/puppetmaster/centos.pp b/manifests/puppetmaster/centos.pp new file mode 100644 index 0000000..eab652b --- /dev/null +++ b/manifests/puppetmaster/centos.pp @@ -0,0 +1,12 @@ +# manifests/puppetmaster/centos.pp + +class puppet::puppetmaster::centos inherits puppet::puppetmaster::package { + file{'/etc/sysconfig/puppetmaster': + source => [ "puppet://$server/files/puppet/sysconfig/${fqdn}/puppetmaster", + "puppet://$server/files/puppet/sysconfig/${domain}/puppetmaster", + "puppet://$server/files/puppet/sysconfig/puppetmaster", + "puppet://$server/puppet/sysconfig/puppetmaster" ], + notify => Service[puppetmaster], + owner => root, group => 0, mode => 0644; + } +} diff --git a/manifests/puppetmaster/linux.pp b/manifests/puppetmaster/linux.pp new file mode 100644 index 0000000..43cd841 --- /dev/null +++ b/manifests/puppetmaster/linux.pp @@ -0,0 +1,14 @@ +# manifests/puppetmaster/linux.pp + +class puppet::puppetmaster::linux inherits puppet::linux { + + service{'puppetmaster': + ensure => running, + enable => true, + require => [ Package[puppet] ], + } + + Service[puppet]{ + require +> Service[puppetmaster], + } +} diff --git a/manifests/puppetmaster/package.pp b/manifests/puppetmaster/package.pp new file mode 100644 index 0000000..d7c477d --- /dev/null +++ b/manifests/puppetmaster/package.pp @@ -0,0 +1,9 @@ +# manifests/puppetmaster/package.pp + +class puppet::puppetmaster::package inherits puppet::puppetmaster::linux { + package { puppet-server: ensure => present } + + Service[puppetmaster]{ + require +> Package[puppet-server], + } +} |