From c4e6d980566e4902b25ca40f0d56772f491cd686 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Wed, 17 Feb 2010 16:50:26 -0200 Subject: Adding support for mongrel --- .gitignore | 1 + files/etc/default/puppetmaster | 40 ---------------------------------------- manifests/puppetmasterd.pp | 29 ++++++++++++++++++++++++++++- templates/puppetmaster.erb | 37 +++++++++++++++++++++++++++++++++++++ 4 files changed, 66 insertions(+), 41 deletions(-) create mode 100644 .gitignore delete mode 100644 files/etc/default/puppetmaster create mode 100644 templates/puppetmaster.erb diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1377554 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.swp diff --git a/files/etc/default/puppetmaster b/files/etc/default/puppetmaster deleted file mode 100644 index 23a7dfd..0000000 --- a/files/etc/default/puppetmaster +++ /dev/null @@ -1,40 +0,0 @@ -# Defaults for puppetmaster - sourced by /etc/init.d/puppetmaster - -# Start puppet on boot? -START=yes - -# Startup options -#DAEMON_OPTS="" -DAEMON_OPTS="--ssl_client_header=HTTP_X_SSL_SUBJECT" - -# What server type to run -# Options: -# webrick (default, cannot handle more than ~30 nodes) -# mongrel (scales better than webrick because you can run -# multiple processes if you are getting -# connection-reset or End-of-file errors, switch to -# mongrel. Requires front-end web-proxy such as -# apache, nginx, or pound) -# See: http://reductivelabs.com/trac/puppet/wiki/UsingMongrel -#SERVERTYPE=webrick -SERVERTYPE=mongrel - -# How many puppetmaster instances to start? Its pointless to set this -# higher than 1 if you are not using mongrel. -#PUPPETMASTERS=1 -PUPPETMASTERS=4 - -# What port should the puppetmaster listen on (default: 8140). If -# PUPPETMASTERS is set to a number greater than 1, then the port for -# the first puppetmaster will be set to the port listed below, and -# further instances will be incremented by one -# -# NOTE: if you are using mongrel, then you will need to have a -# front-end web-proxy (such as apache, nginx, pound) that takes -# incoming requests on the port your clients are connecting to -# (default is: 8140), and then passes them off to the mongrel -# processes. In this case it is recommended to run your web-proxy on -# port 8140 and change the below number to something else, such as -# 18140. -#PORT=8140 -PORT=18140 diff --git a/manifests/puppetmasterd.pp b/manifests/puppetmasterd.pp index 2b7ace5..671d787 100644 --- a/manifests/puppetmasterd.pp +++ b/manifests/puppetmasterd.pp @@ -1,5 +1,22 @@ # handles puppetmasterd service class puppetmasterd { + + # Configuration + case $puppetmaster_servertype { + '': { + $puppetmaster_servertype = 'mongrel' + $puppetmaster_daemon_opts = '--ssl_client_header=HTTP_X_SSL_SUBJECT' + } + } + + case $puppetmaster_puppetmasters { + '': { $puppetmaster_puppetmasters = '4' } + } + + case $puppetmaster_port { + '': { $puppetmaster_port = '18140' } + } + # warns that this node has a puppetmaster $puppetmasterd_present = true @@ -16,10 +33,20 @@ class puppetmasterd { # for storeconfigs include mysql::server + file { "/etc/default/puppetmaster": + ensure => present, + owner => root, + group => root, + mode => 0644, + content => template('puppet/puppetmaster.erb'), + notify => Service['puppetmaster'], + } + service { "puppetmaster": enable => true, ensure => running, hasrestart => true, + require => Package['puppetmaster'], } # cron rule to update puppet config repository every 5 minutes @@ -49,7 +76,7 @@ class puppetmasterd { ensure => present, } - # TODO: database creation as suggested by + # Database creation as suggested by # http://reductivelabs.com/trac/puppet/wiki/Recipes/MySQLStoredConfiguration #exec { "create-storeconfigs-db": # command => "/usr/bin/mysqladmin create puppet", diff --git a/templates/puppetmaster.erb b/templates/puppetmaster.erb new file mode 100644 index 0000000..0aa5f3b --- /dev/null +++ b/templates/puppetmaster.erb @@ -0,0 +1,37 @@ +# Defaults for puppetmaster - sourced by /etc/init.d/puppetmaster + +# Start puppet on boot? +START=yes + +# Startup options +#DAEMON_OPTS="" +DAEMON_OPTS="<%= puppetmaster_daemon_opts %>" + +# What server type to run +# Options: +# webrick (default, cannot handle more than ~30 nodes) +# mongrel (scales better than webrick because you can run +# multiple processes if you are getting +# connection-reset or End-of-file errors, switch to +# mongrel. Requires front-end web-proxy such as +# apache, nginx, or pound) +# See: http://reductivelabs.com/trac/puppet/wiki/UsingMongrel +SERVERTYPE=<%= puppetmaster_servertype %> + +# How many puppetmaster instances to start? Its pointless to set this +# higher than 1 if you are not using mongrel. +PUPPETMASTERS=<%= puppetmaster_puppetmasters %> + +# What port should the puppetmaster listen on (default: 8140). If +# PUPPETMASTERS is set to a number greater than 1, then the port for +# the first puppetmaster will be set to the port listed below, and +# further instances will be incremented by one +# +# NOTE: if you are using mongrel, then you will need to have a +# front-end web-proxy (such as apache, nginx, pound) that takes +# incoming requests on the port your clients are connecting to +# (default is: 8140), and then passes them off to the mongrel +# processes. In this case it is recommended to run your web-proxy on +# port 8140 and change the below number to something else, such as +# 18140. +PORT=<%= puppetmaster_port %> -- cgit v1.2.3