diff options
author | Micah Anderson <micah@riseup.net> | 2012-04-12 15:35:03 -0400 |
---|---|---|
committer | Micah Anderson <micah@riseup.net> | 2012-04-12 15:35:03 -0400 |
commit | dffec4d8134be8a2eb2bb3a8063b2d60d67308f1 (patch) | |
tree | 4b78702a3c720b3f73a005c738dc90aac1e136d1 | |
parent | 4ebf3b82818427303d4d9d83daca8addcbc6f53c (diff) | |
parent | 506767d73515f79e05057df928bf7baa94b0dfcc (diff) |
Merge remote-tracking branch 'lelutin/freebsd' into shared
-rw-r--r-- | files/client/puppet.conf.FreeBSD | 26 | ||||
-rw-r--r-- | manifests/cron.pp | 1 | ||||
-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, 90 insertions, 3 deletions
diff --git a/files/client/puppet.conf.FreeBSD b/files/client/puppet.conf.FreeBSD new file mode 100644 index 0000000..71bcf77 --- /dev/null +++ b/files/client/puppet.conf.FreeBSD @@ -0,0 +1,26 @@ +[main] + logdir=/var/log/puppet + vardir=/var/puppet + rundir=/var/run/puppet + + ssldir=/var/puppet/ssl + + # Where 3rd party plugins and modules are installed + libdir = $vardir/lib + + templatedir=$vardir/templates + + # Turn plug-in synchronization on. + pluginsync = true + pluginsource = puppet://$server/plugins + factpath = $vardir/lib/facter + +[puppetd] + report=true + server=server.example.com + + # different run-interval, default= 30min + # e.g. run puppetd every 4 hours = 14400 + # runinterval = 14400 + + logdest=$logdir/puppet.log 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/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 25709ea..f2d8613 100644 --- a/manifests/puppetmaster/base.pp +++ b/manifests/puppetmaster/base.pp @@ -5,14 +5,14 @@ class puppet::puppetmaster::base inherits puppet::base { "puppet:///modules/puppet/master/puppet.conf" ], } - 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 |