From 26fb5d12d5da80a8057aeaecaa65e266964d8478 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 27 Dec 2008 15:54:45 +0000 Subject: factored classes out in their own files --- manifests/base.pp | 23 +++++++++++ manifests/centos.pp | 10 +++++ manifests/debian.pp | 16 ++++++++ manifests/gentoo.pp | 12 ++++++ manifests/init.pp | 107 --------------------------------------------------- manifests/linux.pp | 18 +++++++++ manifests/openbsd.pp | 23 +++++++++++ 7 files changed, 102 insertions(+), 107 deletions(-) create mode 100644 manifests/base.pp create mode 100644 manifests/centos.pp create mode 100644 manifests/debian.pp create mode 100644 manifests/gentoo.pp create mode 100644 manifests/linux.pp create mode 100644 manifests/openbsd.pp diff --git a/manifests/base.pp b/manifests/base.pp new file mode 100644 index 0000000..7e65408 --- /dev/null +++ b/manifests/base.pp @@ -0,0 +1,23 @@ +class puppet::base { + case $puppet_config { + '': { $puppet_config = '/etc/puppet/puppet.conf' } + } + + file { 'puppet_config': + path => "$puppet_config", + source => [ "puppet://$server/files/puppet/client/${fqdn}/puppet.conf", + "puppet://$server/files/puppet/client/puppet.conf.$operatingsystem", + "puppet://$server/files/puppet/client/puppet.conf", + "puppet://$server/puppet/client/puppet.conf.$operatingsystem", + "puppet://$server/puppet/client/puppet.conf" ], + notify => Service[puppet], + owner => root, group => 0, mode => 600; + } + service{'puppet': + ensure => running, + enable => true, + hasstatus => true, + hasrestart => true, + pattern => puppetd, + } +} diff --git a/manifests/centos.pp b/manifests/centos.pp new file mode 100644 index 0000000..fd121cd --- /dev/null +++ b/manifests/centos.pp @@ -0,0 +1,10 @@ +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], + owner => root, group => 0, mode => 0644; + } +} diff --git a/manifests/debian.pp b/manifests/debian.pp new file mode 100644 index 0000000..307d8a9 --- /dev/null +++ b/manifests/debian.pp @@ -0,0 +1,16 @@ +class puppet::debian inherits puppet::linux { + file{'/etc/default/puppet': + source => [ "puppet://$server/files/puppet/client/debian/${fqdn}/puppet", + "puppet://$server/files/puppet/client/debian/${domain}/puppet", + "puppet://$server/files/puppet/client/debian/puppet", + "puppet://$server/puppet/client/debian/puppet" ], + notify => Service[puppet], + owner => root, group => 0, mode => 0644; + } # there is really no status cmd for it + Service[puppet]{ + hasstatus => false, + } + File['/etc/cron.d/puppetd.cron']{ + path => '/etc/cron.d/puppetd', + } +} diff --git a/manifests/gentoo.pp b/manifests/gentoo.pp new file mode 100644 index 0000000..59d299f --- /dev/null +++ b/manifests/gentoo.pp @@ -0,0 +1,12 @@ +class puppet::gentoo inherits puppet::linux { + Package[puppet]{ + category => 'app-admin', + } + Package[facter]{ + category => 'dev-ruby', + } + # as we use sometimes the init script to test + Service[puppet]{ + hasstatus => false, + } +} diff --git a/manifests/init.pp b/manifests/init.pp index b16eac3..3136c8a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -35,110 +35,3 @@ class puppet { } } - -class puppet::base { - $real_puppet_config = $puppet_config ? { - '' => "/etc/puppet/puppet.conf", - default => $puppet_config, - } - - file { 'puppet_config': - path => "$real_puppet_config", - source => [ "puppet://$server/files/puppet/client/${fqdn}/puppet.conf", - "puppet://$server/files/puppet/client/puppet.conf.$operatingsystem", - "puppet://$server/files/puppet/client/puppet.conf", - "puppet://$server/puppet/client/puppet.conf.$operatingsystem", - "puppet://$server/puppet/client/puppet.conf" ], - notify => Service[puppet], - owner => root, group => 0, mode => 600; - } - service{'puppet': - ensure => running, - enable => true, - hasstatus => true, - hasrestart => true, - pattern => puppetd, - } - -} - -class puppet::linux inherits puppet::base { - package{ [ 'puppet', 'facter' ]: - ensure => present, - } - - # package bc needed for cron - include bc - 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" ], - owner => root, group => 0, mode => 0644; - } -} -class puppet::gentoo inherits puppet::linux { - Package[puppet]{ - category => 'app-admin', - } - Package[facter]{ - category => 'dev-ruby', - } - # as we use sometimes the init script to test - Service[puppet]{ - hasstatus => false, - } -} -class puppet::debian inherits puppet::linux { - file{'/etc/default/puppet': - source => [ "puppet://$server/files/puppet/client/debian/${fqdn}/puppet", - "puppet://$server/files/puppet/client/debian/${domain}/puppet", - "puppet://$server/files/puppet/client/debian/puppet", - "puppet://$server/puppet/client/debian/puppet" ], - notify => Service[puppet], - owner => root, group => 0, mode => 0644; - } # there is really no status cmd for it - Service[puppet]{ - hasstatus => false, - } - File['/etc/cron.d/puppetd.cron']{ - path => '/etc/cron.d/puppetd', - } -} - -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], - owner => root, group => 0, mode => 0644; - } -} -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, - } - openbsd::add_to_rc_local{'puppetd': - binary => '/usr/local/bin/puppetd', - } - cron { 'puppetd_check': - command => '/bin/ps ax | /usr/bin/grep -v grep | /usr/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', - } -} diff --git a/manifests/linux.pp b/manifests/linux.pp new file mode 100644 index 0000000..f6502f2 --- /dev/null +++ b/manifests/linux.pp @@ -0,0 +1,18 @@ +class puppet::linux inherits puppet::base { + package{ [ 'puppet', 'facter' ]: + ensure => present, + } + + # package bc needed for cron + include bc + 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" ], + owner => root, group => 0, mode => 0644; + } +} diff --git a/manifests/openbsd.pp b/manifests/openbsd.pp new file mode 100644 index 0000000..c2fcccb --- /dev/null +++ b/manifests/openbsd.pp @@ -0,0 +1,23 @@ +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, + } + openbsd::add_to_rc_local{'puppetd': + binary => '/usr/local/bin/puppetd', + } + cron { 'puppetd_check': + command => '/bin/ps ax | /usr/bin/grep -v grep | /usr/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