diff options
author | Micah Anderson <micah@riseup.net> | 2012-06-27 22:41:03 -0400 |
---|---|---|
committer | Micah Anderson <micah@riseup.net> | 2012-06-27 22:41:03 -0400 |
commit | f54e980211a88b6e470cb34e78e418e7a7b3de2a (patch) | |
tree | 8f06b32276b73ad8973feeab7ca7f33b464e65c1 /manifests | |
parent | 06942f75f03b5c8a78c8b3a9f466bf72b1b34f5c (diff) | |
parent | dffec4d8134be8a2eb2bb3a8063b2d60d67308f1 (diff) |
Merge remote-tracking branch 'shared/master'
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/cron.pp | 1 | ||||
-rw-r--r-- | manifests/cron/base.pp | 46 | ||||
-rw-r--r-- | manifests/cron/freebsd.pp | 23 | ||||
-rw-r--r-- | manifests/freebsd.pp | 27 | ||||
-rw-r--r-- | manifests/init.pp | 12 | ||||
-rw-r--r-- | manifests/puppetmaster/base.pp | 4 |
6 files changed, 86 insertions, 27 deletions
diff --git a/manifests/cron.pp b/manifests/cron.pp index 693a430..9a632ff 100644 --- a/manifests/cron.pp +++ b/manifests/cron.pp @@ -5,6 +5,7 @@ class puppet::cron inherits puppet { linux: { include puppet::cron::linux } debian: { include puppet::cron::debian } openbsd: { include puppet::cron::openbsd } + freebsd: { include puppet::cron::freebsd } default: { include puppet::cron::base } } } diff --git a/manifests/cron/base.pp b/manifests/cron/base.pp index 7b40da6..7daa6fb 100644 --- a/manifests/cron/base.pp +++ b/manifests/cron/base.pp @@ -1,34 +1,32 @@ # manifests/cron/base.pp class puppet::cron::base inherits puppet::base { - - case $operatingsystem { - debian: { if $lsbdistcodename != 'lenny' { $stop_service = true } else { $stop_service = false } } - openbsd, ubuntu: { $stop_service = false } - default: { $stop_service = true } - } - + Service['puppet']{ enable => false, } - if $stop_service == true { - $puppet_majorversion = regsubst($puppetversion,'^(\d+\.\d+).*$','\1') - if $puppet_majorversion == '2.6' { - Service['puppet']{ - ensure => stopped, - } - } else { - Service['puppet']{ - hasstatus => false, - pattern => 'puppetd', - } - # this works only on < 2.6 - exec { 'stop_puppet': - command => 'kill `cat /var/run/puppet/puppetd.pid`', - onlyif => 'test -f /var/run/puppet/puppetd.pid', - require => Service['puppet'], + case $operatingsystem { + debian,openbsd,ubuntu: { + #it's already disabled + } + default: { + $puppet_majorversion = regsubst($puppetversion,'^(\d+\.\d+).*$','\1') + if $puppet_majorversion == '2.6' { + Service['puppet']{ + ensure => stopped, + } + } else { + Service['puppet']{ + hasstatus => false, + pattern => 'puppetd', + } + # this works only on < 2.6 + exec { 'stop_puppet': + command => 'kill `cat /var/run/puppet/puppetd.pid`', + onlyif => 'test -f /var/run/puppet/puppetd.pid', + require => Service['puppet'], + } } } } } - diff --git a/manifests/cron/freebsd.pp b/manifests/cron/freebsd.pp new file mode 100644 index 0000000..5ff3419 --- /dev/null +++ b/manifests/cron/freebsd.pp @@ -0,0 +1,23 @@ +class puppet::cron::freebsd inherits puppet::freebsd { + + include puppet::cron::base + if $puppet_http_compression { $puppet_http_compression_str = '--http_compression' } + + if !$puppet_crontime { + $puppet_crontime_interval_minute = fqdn_rand(29) + $puppet_crontime_interval_minute2 = inline_template('<%= 30+puppet_crontime_interval_minute.to_i %>') + $puppet_crontime = "${puppet_crontime_interval_minute},${puppet_crontime_interval_minute2} * * * *" + } + + #TODO ensure that the service is disabled in /etc/rc.conf[.local] + + cron { 'puppetd_run': + command => "/usr/local/bin/puppet agent --onetime --no-daemonize --config=${puppet::puppet_config} --color false $puppet_http_compression_str | grep -E '(^err:|^alert:|^emerg:|^crit:)'", + user => 'root', + minute => split(regsubst($puppet_crontime,'^([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+)$','\1'),','), + hour => split(regsubst($puppet_crontime,'^([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+)$','\2'),','), + weekday => split(regsubst($puppet_crontime,'^([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+)$','\3'),','), + month => split(regsubst($puppet_crontime,'^([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+)$','\4'),','), + monthday => split(regsubst($puppet_crontime,'^([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+)$','\5'),',') + } +} diff --git a/manifests/freebsd.pp b/manifests/freebsd.pp new file mode 100644 index 0000000..cdce989 --- /dev/null +++ b/manifests/freebsd.pp @@ -0,0 +1,27 @@ +class puppet::freebsd inherits puppet::base { + + case $puppet_ensure_version { + '': { $puppet_ensure_version = 'installed' } + 'removed','absent','installed', 'present': {} # those values are OK + default: { fail('Package providers for FreeBSD cannot ensure that a specific version is installed.') } + } + case $facter_ensure_version { + '': { $facter_ensure_version = 'installed' } + 'removed','absent','installed', 'present': {} # those values are OK + default: { fail('Package providers for FreeBSD cannot ensure that a specific version is installed.') } + } + + package { 'puppet': + ensure => $puppet_ensure_version, + } + + package { 'facter': + ensure => $facter_ensure_version, + } + + Service['puppet'] { + path => '/usr/local/etc/rc.d', + require => Package[puppet], + } + +} diff --git a/manifests/init.pp b/manifests/init.pp index e9d9748..c05631a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -19,8 +19,17 @@ # class puppet { + $default_config_dir = $operatingsystem ? { + freebsd => "/usr/local/etc/puppet", + default => "/etc/puppet", + } + + $puppet_default_config = "$default_config_dir/puppet.conf" + + if $puppet_config == '' { $puppet_config = $puppet_default_config } + case $kernel { - linux: { + linux: { case $operatingsystem { gentoo: { include puppet::gentoo } centos: { include puppet::centos } @@ -29,6 +38,7 @@ class puppet { } } openbsd: { include puppet::openbsd } + freebsd: { include puppet::freebsd } default: { include puppet::base } } diff --git a/manifests/puppetmaster/base.pp b/manifests/puppetmaster/base.pp index f179d47..a7dc7a5 100644 --- a/manifests/puppetmaster/base.pp +++ b/manifests/puppetmaster/base.pp @@ -8,14 +8,14 @@ class puppet::puppetmaster::base inherits puppet::base { ], } - if !$puppet_fileserverconfig { $puppet_fileserverconfig = '/etc/puppet/fileserver.conf' } + if !$puppet_fileserverconfig { $puppet_fileserverconfig = "${puppet::default_config_dir}/fileserver.conf" } file { "$puppet_fileserverconfig": source => [ "puppet:///modules/site-puppet/master/${fqdn}/fileserver.conf", "puppet:///modules/site-puppet/master/fileserver.conf", "puppet:///modules/puppet/master/fileserver.conf" ], owner => root, group => puppet, mode => 640; - } + } if $puppetmaster_storeconfigs { include puppet::puppetmaster::storeconfigs |