summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--files/cron.d/puppetd1
-rw-r--r--files/cron.d/puppetmaster1
-rw-r--r--manifests/puppetd.pp14
-rw-r--r--templates/check-puppetd.sh.erb (renamed from files/check-puppetd.sh)12
-rw-r--r--templates/puppet-node.conf.erb2
5 files changed, 16 insertions, 14 deletions
diff --git a/files/cron.d/puppetd b/files/cron.d/puppetd
index 5a45875..2cb9acf 100644
--- a/files/cron.d/puppetd
+++ b/files/cron.d/puppetd
@@ -1,3 +1,2 @@
# 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 4ea0b66..8ddbe54 100644
--- a/files/cron.d/puppetmaster
+++ b/files/cron.d/puppetmaster
@@ -1,3 +1,2 @@
# we restart puppetmaster twice a day to avoid memory problems
58 11 * * * root /etc/init.d/puppetmaster restart > /dev/null
-
diff --git a/manifests/puppetd.pp b/manifests/puppetd.pp
index 66edf43..7f00241 100644
--- a/manifests/puppetd.pp
+++ b/manifests/puppetd.pp
@@ -32,9 +32,9 @@ class puppetd inherits puppet {
# name of puppet agent section in config file
if $puppetversion <= "0.25.4" {
- $puppet_agent_section = 'puppetd'
+ $puppet_agent_name = 'puppetd'
} else {
- $puppet_agent_section = 'agent'
+ $puppet_agent_name = 'agent'
}
# default config file for puppet nodes
@@ -59,11 +59,11 @@ class puppetd inherits puppet {
}
file { "/usr/local/sbin/check-puppetd.sh":
- source => "puppet://$server/modules/puppet/check-puppetd.sh",
- owner => "puppet",
- group => "puppet",
- mode => 0755,
- ensure => present,
+ content => template("puppet/check-puppetd.sh.erb"),
+ owner => "puppet",
+ group => "puppet",
+ mode => 0755,
+ ensure => present,
}
cron { "puppetd-check":
diff --git a/files/check-puppetd.sh b/templates/check-puppetd.sh.erb
index 10d6bc1..639a1d5 100644
--- a/files/check-puppetd.sh
+++ b/templates/check-puppetd.sh.erb
@@ -3,15 +3,19 @@
# check if puppet is running
#
-PID="/var/run/puppet/agent.pid"
+PID="/var/run/puppet/<%= puppet_agent_name %>.pid"
INIT="/etc/init.d/puppet"
-if [ ! -f "$PID" ]; then
+function puppet_start {
+ sleep `echo $RANDOM/2000*60 | bc`
$INIT start
+}
+
+if [ ! -f "$PID" ]; then
+ puppet_start
else
running="$(ps $(cat $PID) &> /dev/null)"
if [ "$?" != "0" ]; then
- sleep `echo $RANDOM/2000*60 | bc`
- $INIT start
+ puppet_start
fi
fi
diff --git a/templates/puppet-node.conf.erb b/templates/puppet-node.conf.erb
index 033c2e5..f8b1b32 100644
--- a/templates/puppet-node.conf.erb
+++ b/templates/puppet-node.conf.erb
@@ -6,7 +6,7 @@ rundir = /var/run/puppet
factpath = $vardir/lib/facter
pluginsync = true
-[<%= puppet_agent_section %>]
+[<%= puppet_agent_name %>]
vardir = /var/lib/puppet
ssldir = $vardir/ssl
server = puppet.<%= domain %>