]> gitweb.fluxo.info Git - puppet-puppet.git/commitdiff
Enhancing check-puppetd.sh
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 19 Feb 2011 21:14:12 +0000 (19:14 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 19 Feb 2011 21:14:12 +0000 (19:14 -0200)
files/cron.d/puppetd
files/cron.d/puppetmaster
manifests/puppetd.pp
templates/check-puppetd.sh.erb [moved from files/check-puppetd.sh with 57% similarity]
templates/puppet-node.conf.erb

index 5a458754bd9d132ac7d2435e3108bfdc7f5b20a7..2cb9acfb39e7aa8fa722b46e2918444e83a41e56 100644 (file)
@@ -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
-
index 4ea0b6653e924a219bcd5d4f1817bb967fa5045c..8ddbe54d6f35f13f1e18591e263416402f4e9fcc 100644 (file)
@@ -1,3 +1,2 @@
 # we restart puppetmaster twice a day to avoid memory problems
 58 11 * * * root /etc/init.d/puppetmaster restart > /dev/null
-
index 66edf434821d3a4cd5a41f19032113a1fc7b6f6d..7f0024135915b14acf59dfd18710b6fe60e797cc 100644 (file)
@@ -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":
similarity index 57%
rename from files/check-puppetd.sh
rename to templates/check-puppetd.sh.erb
index 10d6bc1e692f96cc5f43b59fac4a548caaf210ac..639a1d519333fde47e29dc5d640efb0b22a65541 100644 (file)
@@ -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
index 033c2e507d305e7a74969c861aa17e331ea99af7..f8b1b32755d9cfed36e62a811e1af09f18a3a200 100644 (file)
@@ -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 %>