summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README41
-rw-r--r--files/master/config.ru30
-rw-r--r--files/master/puppet.conf9
-rw-r--r--manifests/base.pp8
-rw-r--r--manifests/centos.pp6
-rw-r--r--manifests/cron.pp10
-rw-r--r--manifests/debian.pp6
-rw-r--r--manifests/linux.pp2
-rw-r--r--manifests/puppetmaster/base.pp11
-rw-r--r--manifests/puppetmaster/centos.pp6
-rw-r--r--manifests/puppetmaster/cleanup_reports.pp4
-rw-r--r--manifests/puppetmaster/debian.pp21
-rw-r--r--manifests/puppetmaster/linux.pp2
-rw-r--r--manifests/puppetmaster/package.pp14
-rw-r--r--manifests/puppetmaster/package/base.pp6
-rw-r--r--manifests/puppetmaster/package/debian.pp15
-rw-r--r--manifests/puppetmaster/passenger.pp2
17 files changed, 123 insertions, 70 deletions
diff --git a/README b/README
index 2063b03..6fd494e 100644
--- a/README
+++ b/README
@@ -1,16 +1,28 @@
Puppet-Module for configuring Puppet itself, both the master and the clients
============================================================================
-Use a seperate local module called "site-puppet", where you place your customized
+Use a seperate local module called "site_puppet", where you place your customized
files, under:
- site-puppet/files/master/fileserver.conf
- site-puppet/files/master/puppet.conf
+ site_puppet/files/master/fileserver.conf
+ site_puppet/files/master/puppet.conf
Usage
=====
-The module currently looks for values on different variables to adjust
-configuration of the master.
+The module currently looks for different variable values to adjust configuration
+of the master.
+
+Installing a specific versions
+------------------------------
+
+If you need to install a different version of puppet, other than the most recent,
+you can set the following variable:
+
+$puppet_ensure_version = '2.7.18-1~bpo60+1'
+
+You can also specify a different facter version by setting the following variable:
+
+$facter_ensure_version = '1.6.9-2~bpo60+2'
Run puppet by cron:
-------------------
@@ -49,6 +61,14 @@ mode, you can set $puppetmaster_mode either to:
In both cases you have to setup the appropriate frontends (apache vhost
configuration/nginx vhost configuration) on your own.
+If you need to install a specific version of puppetmaster, you can specify the
+version to be installed by doing the following:
+
+$puppetmaster_ensure_version = '2.7.18-1~bpo60+1'
+
+NOTE: You will need the apt module in order to specify the puppetmaster version.
+Also, this functionality is only implemented for Debian and derived distributions.
+
Munin
-----
@@ -68,6 +88,9 @@ values:
* 'X', where X is the amount of days you want to keep reports for
* false, to disable reports cleanup
+If your reports are in a different place than the default, you can set
+$puppetmaster_reports_dir to adjust their location.
+
Check last run:
---------------
@@ -92,7 +115,7 @@ $puppet_storeconfig_password to the puppet database password, and then set
$puppetmaster_storeconfigs = true to enable stored configs.
Then you will need to either put in your node definition, or in
-site-puppet/manifests/init.pp puppet::puppetmaster::hasdb to setup the database
+site_puppet/manifests/init.pp puppet::puppetmaster::hasdb to setup the database
with the right parameters. This will setup your storeconfigs database, adding to
the database the correct user, the correct grant permissions, and also setup
a munin graph, if you have $use_munin = true
@@ -112,14 +135,14 @@ node puppetmaster {
$use_munin = true
$puppetmaster_mode = 'passenger'
$puppet_crontime = "0,12 * * * *"
- include site-puppet::master
+ include site_puppet::master
include puppet::cron
include puppet::puppetmaster
...
-in your site-puppet/manifests/master.pp you could include something like:
+in your site_puppet/manifests/master.pp you could include something like:
-class site-puppet::master {
+class site_puppet::master {
...
puppet::puppetmaster::hasdb { "puppet":
dbname => 'puppetmaster',
diff --git a/files/master/config.ru b/files/master/config.ru
index cec2a34..b0fd250 100644
--- a/files/master/config.ru
+++ b/files/master/config.ru
@@ -4,26 +4,28 @@
# if puppet is not in your RUBYLIB:
# $:.unshift('/opt/puppet/lib')
-$0 = "puppetmasterd"
-require 'puppet'
-
-# logs to file instead of syslog
-#Puppet::Util::Log.newdestination("/var/log/puppet/puppetmasterd.log")
+$0 = "master"
# if you want debugging:
-#ARGV << "--debug"
+# ARGV << "--debug"
ARGV << "--rack"
-# in some setups puppetmasterd doesn't seem to read the puppet.conf
-# config at startup, then you need to pass these options:
-ARGV << "--vardir" << "/var/lib/puppet"
-ARGV << "--ssldir" << "/var/lib/puppet/ssl"
-# if you use puppet-dashboard:
-#ARGV << "--reports" << "puppet_dashboard"
+# NOTE: it's unfortunate that we have to use the "CommandLine" class
+# here to launch the app, but it contains some initialization logic
+# (such as triggering the parsing of the config file) that is very
+# important. We should do something less nasty here when we've
+# gotten our API and settings initialization logic cleaned up.
+#
+# Also note that the "$0 = master" line up near the top here is
+# the magic that allows the CommandLine class to know that it's
+# supposed to be running master.
+#
+# --cprice 2012-05-22
-require 'puppet/application/puppetmasterd'
+require 'puppet/util/command_line'
# we're usually running inside a Rack::Builder.new {} block,
# therefore we need to call run *here*.
-run Puppet::Application[:puppetmasterd].run
+run Puppet::Util::CommandLine.new.execute
+
diff --git a/files/master/puppet.conf b/files/master/puppet.conf
index 6b4b0e9..f6471d7 100644
--- a/files/master/puppet.conf
+++ b/files/master/puppet.conf
@@ -20,7 +20,7 @@
factpath = $vardir/lib/facter
plugindest = $vardir/lib/puppet
-[puppetd]
+[agent]
# The file in which puppetd stores a list of the classes
# associated with the retrieved configuratiion. Can be loaded in
# the separate ``puppet`` executable using the ``--loadclasses``
@@ -35,14 +35,13 @@
report=true
pluginsync = true
- factsync=true
logdest=/var/log/puppet/puppet.log
-[puppetmasterd]
+[master]
reportdir = $logdir/reports
autoflush = true
- storeconfigs=true
+ #storeconfigs=true
dbadapter=mysql
dbserver=localhost
dbuser=puppet
@@ -63,7 +62,7 @@
# configure environments
[development]
manifest=$vardir/development/etc/manifests/site.pp
- modulepath=$vardir/development/manifests
+ modulepath=$vardir/development/modules/
templatepath=$vardir/development/templates/
[production]
diff --git a/manifests/base.pp b/manifests/base.pp
index 69a7568..6ff8fa5 100644
--- a/manifests/base.pp
+++ b/manifests/base.pp
@@ -6,7 +6,7 @@ class puppet::base {
case $puppet_cleanup_clientbucket {
# if not set, don't do anything
- '': {}
+ '',undef: {}
default: {
tidy { "/var/lib/puppet/clientbucket":
backup => false,
@@ -20,9 +20,9 @@ class puppet::base {
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",
+ 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",
diff --git a/manifests/centos.pp b/manifests/centos.pp
index 61aa065..d98f422 100644
--- a/manifests/centos.pp
+++ b/manifests/centos.pp
@@ -1,9 +1,9 @@
class puppet::centos inherits puppet::linux {
file { '/etc/sysconfig/puppet':
- source => [ "puppet:///modules/site-puppet/sysconfig/${fqdn}/puppet",
- "puppet:///modules/site-puppet/sysconfig/${domain}/puppet",
- "puppet:///modules/site-puppet/sysconfig/puppet",
+ source => [ "puppet:///modules/site_puppet/sysconfig/${fqdn}/puppet",
+ "puppet:///modules/site_puppet/sysconfig/${domain}/puppet",
+ "puppet:///modules/site_puppet/sysconfig/puppet",
"puppet:///modules/puppet/sysconfig/puppet" ],
notify => Service[puppet],
owner => root, group => 0, mode => 0644;
diff --git a/manifests/cron.pp b/manifests/cron.pp
index 9a632ff..f593a00 100644
--- a/manifests/cron.pp
+++ b/manifests/cron.pp
@@ -1,11 +1,13 @@
-# manifests/cron.pp
-
class puppet::cron inherits puppet {
case $operatingsystem {
- 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 }
+ default: {
+ case $kernel {
+ linux: { include puppet::cron::linux }
+ default: { include puppet::cron::base }
+ }
+ }
}
}
diff --git a/manifests/debian.pp b/manifests/debian.pp
index f0479ae..e0cf4bc 100644
--- a/manifests/debian.pp
+++ b/manifests/debian.pp
@@ -1,9 +1,9 @@
class puppet::debian inherits puppet::linux {
file { '/etc/default/puppet':
- source => [ "puppet:///modules/site-puppet/client/debian/${fqdn}/puppet",
- "puppet:///modules/site-puppet/client/debian/${domain}/puppet",
- "puppet:///modules/site-puppet/client/debian/puppet",
+ source => [ "puppet:///modules/site_puppet/client/debian/${fqdn}/puppet",
+ "puppet:///modules/site_puppet/client/debian/${domain}/puppet",
+ "puppet:///modules/site_puppet/client/debian/puppet",
"puppet:///modules/puppet/client/debian/puppet" ],
notify => Service[puppet],
owner => root, group => 0, mode => 0644;
diff --git a/manifests/linux.pp b/manifests/linux.pp
index 13788ef..d17b386 100644
--- a/manifests/linux.pp
+++ b/manifests/linux.pp
@@ -15,7 +15,7 @@ class puppet::linux inherits puppet::base {
}
file { '/etc/cron.d/puppetd.cron':
- source => [ "puppet:///modules/site-puppet/cron.d/puppetd",
+ source => [ "puppet:///modules/site_puppet/cron.d/puppetd",
"puppet:///modules/puppet/cron.d/puppetd.${operatingsystem}",
"puppet:///modules/puppet/cron.d/puppetd" ],
owner => root, group => 0, mode => 0644,
diff --git a/manifests/puppetmaster/base.pp b/manifests/puppetmaster/base.pp
index f2d8613..a313ff2 100644
--- a/manifests/puppetmaster/base.pp
+++ b/manifests/puppetmaster/base.pp
@@ -1,15 +1,18 @@
class puppet::puppetmaster::base inherits puppet::base {
File[puppet_config]{
- source => [ "puppet:///modules/site-puppet/master/puppet.conf",
- "puppet:///modules/puppet/master/puppet.conf" ],
+ source => [
+ "puppet:///modules/site_puppet/master/${fqdn}/puppet.conf",
+ "puppet:///modules/site_puppet/master/puppet.conf",
+ "puppet:///modules/puppet/master/puppet.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",
+ 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;
}
diff --git a/manifests/puppetmaster/centos.pp b/manifests/puppetmaster/centos.pp
index 2673a4d..a6f5e23 100644
--- a/manifests/puppetmaster/centos.pp
+++ b/manifests/puppetmaster/centos.pp
@@ -2,9 +2,9 @@
class puppet::puppetmaster::centos inherits puppet::puppetmaster::package {
file { '/etc/sysconfig/puppetmaster':
- source => [ "puppet:///modules/site-puppet/sysconfig/${fqdn}/puppetmaster",
- "puppet:///modules/site-puppet/sysconfig/${domain}/puppetmaster",
- "puppet:///modules/site-puppet/sysconfig/puppetmaster",
+ source => [ "puppet:///modules/site_puppet/sysconfig/${fqdn}/puppetmaster",
+ "puppet:///modules/site_puppet/sysconfig/${domain}/puppetmaster",
+ "puppet:///modules/site_puppet/sysconfig/puppetmaster",
"puppet:///modules/puppet/sysconfig/puppetmaster" ],
notify => Service[puppetmaster],
owner => root, group => 0, mode => 0644;
diff --git a/manifests/puppetmaster/cleanup_reports.pp b/manifests/puppetmaster/cleanup_reports.pp
index 664bd81..005a4d7 100644
--- a/manifests/puppetmaster/cleanup_reports.pp
+++ b/manifests/puppetmaster/cleanup_reports.pp
@@ -1,8 +1,8 @@
class puppet::puppetmaster::cleanup_reports {
-
+ case $puppetmaster_reports_dir { '',undef: { $puppetmaster_reports_dir = '/var/lib/puppet/reports' } }
# clean up reports older than $puppetmaster_cleanup_reports days
file { '/etc/cron.daily/puppet_reports_cleanup.sh':
- content => "#!/bin/bash\nfind /var/lib/puppet/reports/ -maxdepth 2 -type f -ctime +${puppetmaster_cleanup_reports} -exec rm {} \\;\n",
+ content => "#!/bin/bash\nfind ${puppetmaster_reports_dir} -maxdepth 2 -type f -ctime +${puppetmaster_cleanup_reports} -exec rm {} \\;\n",
owner => root, group => 0, mode => 0700;
}
}
diff --git a/manifests/puppetmaster/debian.pp b/manifests/puppetmaster/debian.pp
index 853a0e6..f440ba3 100644
--- a/manifests/puppetmaster/debian.pp
+++ b/manifests/puppetmaster/debian.pp
@@ -1,5 +1,8 @@
-class puppet::puppetmaster::debian inherits puppet::puppetmaster::package {
+class puppet::puppetmaster::debian {
+ include puppet::puppetmaster::package
+ include puppet::puppetmaster::linux
+
if $puppetmaster_mode != 'passenger' {
case $lsbdistcodename {
squeeze,sid: {
@@ -8,14 +11,18 @@ class puppet::puppetmaster::debian inherits puppet::puppetmaster::package {
}
}
+ if $puppetmaster_mode == 'passenger' {
+ $puppetmaster_default_nofity = 'Exec[notify_passenger_puppetmaster]'
+ }
+
file { '/etc/default/puppetmaster':
- source => [ "puppet:///modules/site-puppet/master/debian/${fqdn}/puppetmaster",
- "puppet:///modules/site-puppet/master/debian/${domain}/puppetmaster",
- "puppet:///modules/site-puppet/master/debian/puppetmaster",
+ source => [ "puppet:///modules/site_puppet/master/debian/${fqdn}/puppetmaster",
+ "puppet:///modules/site_puppet/master/debian/${domain}/puppetmaster",
+ "puppet:///modules/site_puppet/master/debian/puppetmaster",
"puppet:///modules/puppet/master/debian/puppetmaster" ],
- notify => $puppetmaster_mode ? {
- 'passenger' => Exec['notify_passenger_puppetmaster'],
- default => Service[puppetmaster],
+ notify => $puppetmaster_default_nofity ? {
+ '' => Service[puppetmaster],
+ default => Exec['notify_passenger_puppetmaster']
},
owner => root, group => 0, mode => 0644;
}
diff --git a/manifests/puppetmaster/linux.pp b/manifests/puppetmaster/linux.pp
index 7c2e428..39ca544 100644
--- a/manifests/puppetmaster/linux.pp
+++ b/manifests/puppetmaster/linux.pp
@@ -6,7 +6,7 @@ class puppet::puppetmaster::linux inherits puppet::linux {
exec { 'notify_passenger_puppetmaster':
refreshonly => true,
- #command => 'touch /etc/puppet/rack/tmp/restart.txt && sleep 1 && rm /etc/puppet/rack/tmp/restart.txt',
+ # command => '/usr/bin/touch /etc/puppet/rack/tmp/restart.txt && sleep 1 && /bin/rm /etc/puppet/rack/tmp/restart.txt',
command => '/etc/init.d/apache2 reload',
}
diff --git a/manifests/puppetmaster/package.pp b/manifests/puppetmaster/package.pp
index 145792e..aef3121 100644
--- a/manifests/puppetmaster/package.pp
+++ b/manifests/puppetmaster/package.pp
@@ -1,9 +1,17 @@
# manifests/puppetmaster/package.pp
-class puppet::puppetmaster::package inherits puppet::puppetmaster::linux {
+class puppet::puppetmaster::package {
case $operatingsystem {
- centos: { include puppet::puppetmaster::package::centos }
+ centos: {
+ if $puppetmaster_ensure_version {
+ warn('$puppetmaster_ensure_version is not supported for this operatingsystem')
+ }
+ include puppet::puppetmaster::package::centos }
debian: { include puppet::puppetmaster::package::debian }
- default: { include puppet::puppetmaster::package::base }
+ default: {
+ if $puppetmaster_ensure_version {
+ warn('$puppetmaster_ensure_version is not supported for this operatingsystem')
+ }
+ include puppet::puppetmaster::package::base }
}
}
diff --git a/manifests/puppetmaster/package/base.pp b/manifests/puppetmaster/package/base.pp
index 363f827..ff8d02a 100644
--- a/manifests/puppetmaster/package/base.pp
+++ b/manifests/puppetmaster/package/base.pp
@@ -4,7 +4,9 @@ class puppet::puppetmaster::package::base inherits puppet::puppetmaster::package
ensure => present,
}
- Service['puppetmaster']{
- require +> Package['puppetmaster'],
+ if $puppetmaster_mode != 'passenger' {
+ Service['puppetmaster']{
+ require +> Package['puppetmaster'],
+ }
}
}
diff --git a/manifests/puppetmaster/package/debian.pp b/manifests/puppetmaster/package/debian.pp
index 21407bb..cea7ac4 100644
--- a/manifests/puppetmaster/package/debian.pp
+++ b/manifests/puppetmaster/package/debian.pp
@@ -1,6 +1,13 @@
-class puppet::puppetmaster::package::debian inherits puppet::puppetmaster::package {
+class puppet::puppetmaster::package::debian {
- #Package['puppetmaster']{
- # require => Package['puppetmaster-common']
- #}
+ include puppet::puppetmaster::package::base
+
+ apt::preferences_snippet {
+ 'puppet_passenger':
+ package => 'puppet*',
+ pin => "version $puppetmaster_ensure_version",
+ priority => 2000,
+ notify => Exec['refresh_apt'],
+ before => Package['puppetmaster'];
+ }
}
diff --git a/manifests/puppetmaster/passenger.pp b/manifests/puppetmaster/passenger.pp
index c4bc062..584a559 100644
--- a/manifests/puppetmaster/passenger.pp
+++ b/manifests/puppetmaster/passenger.pp
@@ -13,7 +13,7 @@ class puppet::puppetmaster::passenger inherits puppet::puppetmaster::base {
owner => root, group => 0, mode => 0755;
'/etc/puppet/rack/config.ru':
- source => [ "puppet:///modules/site-puppet/master/config.ru",
+ source => [ "puppet:///modules/site_puppet/master/config.ru",
"puppet:///modules/puppet/master/config.ru" ],
owner => puppet, group => 0, mode => 0644;
}