summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2013-12-05 11:49:56 +0100
committermh <mh@immerda.ch>2013-12-05 11:49:56 +0100
commit8db4cf07c117d62c92b6ff2c46948e7fc4b74c2e (patch)
treecb509090aa881a4b0f107f937606c6006d7a665a
parentf7a31af7c4c44ec11ff1fc61c466c4476e9f093c (diff)
make it possible to pass the content of the config from outside
-rw-r--r--manifests/base.pp53
-rw-r--r--manifests/cron.pp21
-rw-r--r--manifests/init.pp19
-rw-r--r--manifests/master.pp62
4 files changed, 86 insertions, 69 deletions
diff --git a/manifests/base.pp b/manifests/base.pp
index 9e597a8..5cb4c5d 100644
--- a/manifests/base.pp
+++ b/manifests/base.pp
@@ -1,3 +1,4 @@
+# configure general things of puppet
class puppet::base {
$puppet_majorversion = regsubst($::puppetversion,'^(\d+\.\d+).*$','\1')
@@ -5,35 +6,45 @@ class puppet::base {
# if not set, don't do anything
'',undef,false: {}
default: {
- tidy { "/var/lib/puppet/clientbucket":
- backup => false,
+ tidy { '/var/lib/puppet/clientbucket':
+ backup => false,
recurse => true,
- rmdirs => true,
- type => mtime,
- age => "$puppet::cleanup_clientbucket";
+ rmdirs => true,
+ type => mtime,
+ age => $puppet::cleanup_clientbucket;
}
}
}
file { 'puppet_config':
- path => $puppet::config,
- source => [ "puppet:///modules/site_puppet/client/${::fqdn}/puppet.conf",
- "puppet:///modules/site_puppet/client/puppet.conf.${::operatingsystem}",
- "puppet:///modules/site_puppet/client/puppet.conf",
- "puppet:///modules/puppet/client/${puppet_majorversion}/puppet.conf.${::operatingsystem}",
- "puppet:///modules/puppet/client/${puppet_majorversion}/puppet.conf",
- "puppet:///modules/puppet/client/puppet.conf.${::operatingsystem}",
- "puppet:///modules/puppet/client/puppet.conf" ],
- notify => Service[puppet],
- # if puppetmasterd is deployed by apache2/passenger it needs to read puppet.conf
- # therefore it must be readable by puppet
- owner => puppet, group => 0, mode => 600;
+ path => $puppet::config,
+ notify => Service[puppet],
+ # if puppetmasterd is deployed by apache2/passenger it needs
+ # to read puppet.conf. therefore it must be readable by puppet
+ owner => puppet,
+ group => 0,
+ mode => '0600';
+ }
+ if $puppet::config_content {
+ File['puppet_config'] {
+ content => $puppet::config_content
+ }
+ } else {
+ File['puppet_config'] {
+ source => [ "puppet:///modules/site_puppet/client/${::fqdn}/puppet.conf",
+ "puppet:///modules/site_puppet/client/puppet.conf.${::operatingsystem}",
+ 'puppet:///modules/site_puppet/client/puppet.conf',
+ "puppet:///modules/puppet/client/${puppet_majorversion}/puppet.conf.${::operatingsystem}",
+ "puppet:///modules/puppet/client/${puppet_majorversion}/puppet.conf",
+ "puppet:///modules/puppet/client/puppet.conf.${::operatingsystem}",
+ 'puppet:///modules/puppet/client/puppet.conf' ]
+ }
}
service { 'puppet':
- ensure => running,
- enable => true,
- hasstatus => true,
- hasrestart => true,
+ ensure => running,
+ enable => true,
+ hasstatus => true,
+ hasrestart => true,
}
}
diff --git a/manifests/cron.pp b/manifests/cron.pp
index b4d9140..2e54a66 100644
--- a/manifests/cron.pp
+++ b/manifests/cron.pp
@@ -1,17 +1,20 @@
+# run puppet agent as cron
class puppet::cron(
$cron_time,
- $stop_service = true,
- $config = '/etc/puppet/puppet.conf',
- $http_compression = 'puppet_http_compression',
- $cleanup_clientbucket = false,
- $ensure_version = 'installed',
- $ensure_facter_version = 'installed',
- $shorewall_puppetmaster = false,
- $shorewall_puppetmaster_port = '8140',
- $shorewall_puppetmaster_signport = '8141'
+ $stop_service = true,
+ $config = '/etc/puppet/puppet.conf',
+ $config_content = false,
+ $http_compression = 'puppet_http_compression',
+ $cleanup_clientbucket = false,
+ $ensure_version = 'installed',
+ $ensure_facter_version = 'installed',
+ $shorewall_puppetmaster = false,
+ $shorewall_puppetmaster_port = '8140',
+ $shorewall_puppetmaster_signport = '8141'
) {
class{'puppet':
config => $config,
+ config_content => $config_content,
http_compression => $http_compression,
cleanup_clientbucket => $cleanup_clientbucket,
ensure_version => $ensure_version,
diff --git a/manifests/init.pp b/manifests/init.pp
index 3a71ed0..e85447b 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -17,16 +17,17 @@
# General Public License version 3 as published by
# the Free Software Foundation.
#
-
+# Manage the puppet client
class puppet(
- $config = '/etc/puppet/puppet.conf',
- $http_compression = false,
- $cleanup_clientbucket = false,
- $ensure_version = 'installed',
- $ensure_facter_version = 'installed',
- $shorewall_puppetmaster = false,
- $shorewall_puppetmaster_port = 8140,
- $shorewall_puppetmaster_signport = 8141
+ $config = '/etc/puppet/puppet.conf',
+ $config_content = false,
+ $http_compression = false,
+ $cleanup_clientbucket = false,
+ $ensure_version = 'installed',
+ $ensure_facter_version = 'installed',
+ $shorewall_puppetmaster = false,
+ $shorewall_puppetmaster_port = 8140,
+ $shorewall_puppetmaster_signport = 8141
){
case $::kernel {
linux: {
diff --git a/manifests/master.pp b/manifests/master.pp
index af7794b..efff8e9 100644
--- a/manifests/master.pp
+++ b/manifests/master.pp
@@ -1,42 +1,44 @@
# manifests/puppetmaster.pp
class puppet::master(
- $config = '/etc/puppet/puppet.conf',
- $fileserver = '/etc/puppet/fileserver.conf',
- $http_compression = false,
- $cleanup_clientbucket = false,
- $cron_time = false,
- $ensure_version = 'installed',
- $ensure_facter_version = 'installed',
- $lastruncheck_cron = '40 10 * * *',
- $lastruncheck_ignorehosts = '',
- $lastruncheck_timeout = '',
- $lastruncheck_additionaloptions = '',
- $mode = 'webrick',
- $cleanup_reports = '30',
- $reports_dir = '/var/lib/puppet/reports',
- $shorewall_puppetmaster = "domain.${::domain}",
- $shorewall_puppetmaster_port = 8140,
- $shorewall_puppetmaster_signport = 8141,
- $manage_munin = false
+ $config = '/etc/puppet/puppet.conf',
+ $config_content = false,
+ $fileserver = '/etc/puppet/fileserver.conf',
+ $http_compression = false,
+ $cleanup_clientbucket = false,
+ $cron_time = false,
+ $ensure_version = 'installed',
+ $ensure_facter_version = 'installed',
+ $lastruncheck_cron = '40 10 * * *',
+ $lastruncheck_ignorehosts = '',
+ $lastruncheck_timeout = '',
+ $lastruncheck_additionaloptions = '',
+ $mode = 'webrick',
+ $cleanup_reports = '30',
+ $reports_dir = '/var/lib/puppet/reports',
+ $shorewall_puppetmaster = "domain.${::domain}",
+ $shorewall_puppetmaster_port = 8140,
+ $shorewall_puppetmaster_signport = 8141,
+ $manage_munin = false
) {
if $cron_time {
class{'puppet::cron':
- config => $config,
- http_compression => $http_compression,
- cleanup_clientbucket => $cleanup_clientbucket,
- cron_time => $cron_time,
- ensure_version => $ensure_version,
- ensure_facter_version => $ensure_facter_version,
- shorewall_puppetmaster => $shorewall_puppetmaster,
- shorewall_puppetmaster_port => $shorewall_puppetmaster_port,
+ config => $config,
+ config_content => $config_content,
+ http_compression => $http_compression,
+ cleanup_clientbucket => $cleanup_clientbucket,
+ cron_time => $cron_time,
+ ensure_version => $ensure_version,
+ ensure_facter_version => $ensure_facter_version,
+ shorewall_puppetmaster => $shorewall_puppetmaster,
+ shorewall_puppetmaster_port => $shorewall_puppetmaster_port,
shorewall_puppetmaster_signport => $shorewall_puppetmaster_signport,
}
} else {
class{'puppet':
- config => $config,
- http_compression => $http_compression,
- cleanup_clientbucket => $cleanup_clientbucket,
- ensure_version => $ensure_version,
+ config => $config,
+ http_compression => $http_compression,
+ cleanup_clientbucket => $cleanup_clientbucket,
+ ensure_version => $ensure_version,
ensure_facter_version => $ensure_facter_version,
}
}