From 28d4c8142f1ed0cfb0be47e2efac86748c223658 Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 1 Oct 2008 22:04:04 +0000 Subject: rearranged stuff a bit to add support for openbsd --- manifests/init.pp | 65 ++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 45 insertions(+), 20 deletions(-) (limited to 'manifests') diff --git a/manifests/init.pp b/manifests/init.pp index 1f0446b..3f42c3d 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -22,16 +22,21 @@ class puppet { case $kernel { - linux: { case $operatingsystem { - gentoo: { include puppet::gentoo } - centos: { include puppet::centos } - debian: { include puppet::debian } - default: { include puppet::linux} - } + linux: { + case $operatingsystem { + gentoo: { include puppet::gentoo } + centos: { include puppet::centos } + debian: { include puppet::debian } + default: { include puppet::linux} + } } - openbsd: { include puppet::openbsd} + openbsd: { include puppet::openbsd } + default: { include puppet::base } } +} + +class puppet::base { $real_puppet_config = $puppet_config ? { '' => "/etc/puppet/puppet.conf", default => $puppet_config, @@ -47,25 +52,28 @@ class puppet { notify => Service[puppet], owner => root, group => 0, mode => 600; } + service{'puppet': + ensure => running, + enable => true, + hasstatus => true, + hasrestart => true, + pattern => puppetd, + } + } -class puppet::linux { +class puppet::linux inherits puppet::base { package{ [ 'puppet', 'facter' ]: ensure => present, } # package bc needed for cron include bc - - service{'puppet': - ensure => running, - enable => true, - hasstatus => true, - hasrestart => true, - pattern => puppetd, + Service['puppet']{ require => Package[puppet], } + file{'/etc/cron.d/puppetd.cron': source => [ "puppet://$server/puppet/cron.d/puppetd.${operatingsystem}", "puppet://$server/puppet/cron.d/puppetd" ], @@ -111,10 +119,27 @@ class puppet::centos inherits puppet::linux { owner => root, group => 0, mode => 0644; } } -class puppet::openbsd { - service{'puppet': - provider => base, - pattern => puppetd, - ensure => running, +class puppet::openbsd inherits puppet::base { + Service['puppet']{ + restart => '/bin/kill -HUP `/bin/cat /var/run/puppet/puppetd.pid`', + stop => '/bin/kill `/bin/cat /var/run/puppet/puppetd.pid`', + start => '/usr/local/bin/puppetd', + hasstatus => false, + hasrestart => false, + } + exec{'enable_puppet_on_boot': + command => 'echo "if [ -x /usr/local/bin/puppetd ]; then echo -n \' puppetd\'; /usr/local/bin/puppetd; fi" >> /etc/rc.local', + unless => 'grep -q "puppetd" /etc/rc.local', + } + cron { 'puppetd_check': + command => '/bin/ps ax | /bin/grep -v grep | /bin/grep -q puppetd || (sleep `echo $RANDOM/2000*60 | bc` && /usr/local/bin/puppetd)', + user => root, + minute => 0, } + cron { 'puppetd_restart': + command => 'sleep `echo $RANDOM/2000*60 | bc` && /bin/kill `/bin/cat /var/run/puppet/puppetd.pid`; /usr/local/bin/puppetd', + minute => 0, + hour => 22, + monthday => '*/2', + } } -- cgit v1.2.3