summaryrefslogtreecommitdiff
path: root/manifests/init.pp
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2008-10-01 22:04:04 +0000
committermh <mh@immerda.ch>2008-10-01 22:04:04 +0000
commit28d4c8142f1ed0cfb0be47e2efac86748c223658 (patch)
tree143e60c829bbfcfe1b0a5f4125d79b1b4e046414 /manifests/init.pp
parent2176f3295148a6cc22bafb54007db972d749dc44 (diff)
rearranged stuff a bit to add support for openbsd
Diffstat (limited to 'manifests/init.pp')
-rw-r--r--manifests/init.pp65
1 files changed, 45 insertions, 20 deletions
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',
+ }
}