diff options
author | James Turnbull <james@lovedthanlost.net> | 2008-10-21 10:37:56 +1100 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2008-10-21 10:37:56 +1100 |
commit | b53509b4538cf581d2d306b43c11f729ba9a2568 (patch) | |
tree | ef378975a4f916c88a7ea97ecaf0a52ae9c84ca9 /conf | |
parent | 8a4e2e9378fe617b0d6b7210ed63f6d5e5bd9956 (diff) | |
download | puppet-b53509b4538cf581d2d306b43c11f729ba9a2568.tar.gz puppet-b53509b4538cf581d2d306b43c11f729ba9a2568.tar.xz puppet-b53509b4538cf581d2d306b43c11f729ba9a2568.zip |
Fixed #1460 - enhance redhat puppetmaster init.d script to easy start puppetmaster as a mongrel cluster
Diffstat (limited to 'conf')
-rw-r--r-- | conf/redhat/server.init | 49 | ||||
-rw-r--r-- | conf/redhat/server.sysconfig | 22 |
2 files changed, 64 insertions, 7 deletions
diff --git a/conf/redhat/server.init b/conf/redhat/server.init index 8266977de..6871b9a92 100644 --- a/conf/redhat/server.init +++ b/conf/redhat/server.init @@ -1,7 +1,8 @@ #!/bin/bash # puppetmaster This shell script enables the puppetmaster server. # -# Author: Duane Griffin <d.griffin@psenterprise.com> +# Authors: Duane Griffin <d.griffin@psenterprise.com> +# Peter Meier <peter.meier@immerda.ch> (Mongrel enhancements) # # chkconfig: - 65 45 # @@ -22,6 +23,11 @@ fi PUPPETMASTER_OPTS="" [ -n "$PUPPETMASTER_MANIFEST" ] && PUPPETMASTER_OPTS="--manifest=${PUPPETMASTER_MANIFEST}" +if [ -n "$PUPPETMASTER_PORTS" ] && [ ${#PUPPETMASTER_PORTS[@]} -gt 1 ]; then + PUPPETMASTER_OPTS="$PUPPETMASTER_OPTS --servertype=mongrel" +elif [ -n "$PUPPETMASTER_PORTS" ] && [ ${#PUPPETMASTER_PORTS[@]} -eq 1 ]; then + PUPPETMASTER_OPTS="${PUPPETMASTER_OPTS} --masterport=${PUPPETMASTER_PORTS[0]}" +fi [ -n "$PUPPETMASTER_LOG" ] && PUPPETMASTER_OPTS="${PUPPETMASTER_OPTS} --logdest=${PUPPETMASTER_LOG}" PUPPETMASTER_OPTS="${PUPPETMASTER_OPTS} \ ${PUPPETMASTER_EXTRA_OPTS}" @@ -36,8 +42,16 @@ start() { # Confirm the manifest exists if [ -r $PUPPETMASTER_MANIFEST ]; then - daemon $PUPPETMASTER $PUPPETMASTER_OPTS - RETVAL=$? + if [ -n "$PUPPETMASTER_PORTS" ] && [ ${#PUPPETMASTER_PORTS[@]} -gt 1 ]; then + for ((i=0; i<${#PUPPETMASTER_PORTS[@]}; i++)); do + echo -en "\nPort: ${PUPPETMASTER_PORTS[$i]}" + daemon $PUPPETMASTER $PUPPETMASTER_OPTS --masterport=${PUPPETMASTER_PORTS[$i]} --pidfile=/var/run/puppet/puppetmaster.${PUPPETMASTER_PORTS[$i]}.pid + ret=$?; [ $ret != 0 ] && RETVAL=$ret + done + else + daemon $PUPPETMASTER $PUPPETMASTER_OPTS + RETVAL=$? + fi else failure $"Manifest does not exist: $PUPPETMASTER_MANIFEST" echo @@ -50,8 +64,16 @@ start() { stop() { echo -n $"Stopping puppetmaster: " - killproc $PUPPETMASTER - RETVAL=$? + if [ -n "$PUPPETMASTER_PORTS" ] && [ ${#PUPPETMASTER_PORTS[@]} -gt 1 ]; then + for ((i=0; i<${#PUPPETMASTER_PORTS[@]}; i++)); do + echo -en "\nPort: ${PUPPETMASTER_PORTS[$i]}" + killproc -p /var/run/puppet/puppetmaster.${PUPPETMASTER_PORTS[$i]}.pid puppetmaster + ret=$?; [ $ret != 0 ] && RETVAL=$ret + done + else + killproc $PUPPETMASTER + RETVAL=$? + fi echo [ $RETVAL -eq 0 ] && rm -f "$lockfile" return $RETVAL @@ -67,6 +89,20 @@ genconfig() { $PUPPETMASTER $PUPPETMASTER_OPTS --genconfig } +puppetmaster_status() { + if [ -n "$PUPPETMASTER_PORTS" ] && [ ${#PUPPETMASTER_PORTS[@]} -gt 1 ]; then + for ((i=0; i<${#PUPPETMASTER_PORTS[@]}; i++)); do + echo -en "Port ${PUPPETMASTER_PORTS[$i]}: " + status -p /var/run/puppet/puppetmaster.${PUPPETMASTER_PORTS[$i]}.pid puppetmaster + ret=$?; [ $ret != 0 ] && RETVAL=$ret + done + else + status $PUPPETMASTER + RETVAL=$? + fi + return $RETVAL +} + case "$1" in start) start @@ -81,8 +117,7 @@ case "$1" in [ -f "$lockfile" ] && restart ;; status) - status $PUPPETMASTER - RETVAL=$? + puppetmaster_status ;; genconfig) genconfig diff --git a/conf/redhat/server.sysconfig b/conf/redhat/server.sysconfig index fe673cc40..befb40fee 100644 --- a/conf/redhat/server.sysconfig +++ b/conf/redhat/server.sysconfig @@ -5,5 +5,27 @@ # Specify syslog to send log messages to the system log. #PUPPETMASTER_LOG=syslog +# You may specify an alternate port or an array of ports on which +# puppetmaster should listen. Default is: 8140 +# If you specify more than one port, the puppetmaster ist automatically +# started with the servertype set to mongrel. This might be interesting +# if you'd like to run your puppetmaster in a loadbalanced cluster. +# Please note: this won't setup nor start any loadbalancer. +# If you'd like to run puppetmaster with mongrel as servertype but only +# on one (specified) port, you have to add --servertype=mongrel to +# PUPPETMASTER_EXTRA_OPTS. +# Default: Empty (Puppetmaster isn't started with mongrel, nor on a +# specific port) +# +# Please note: Due to reduced options in the rc-functions lib in RHEL/Centos +# versions prior to 5, this feature won't work. Fedora versions >= 8 are +# known to work. +#PUPPETMASTER_PORTS="" +# Puppetmaster on a different port, run with standard webrick servertype +#PUPPETMASTER_PORTS="8141" +# Example with multiple ports which will start puppetmaster with mongrel +# as a servertype +#PUPPETMASTER_PORTS=( 18140 18141 18142 18143 ) + # You may specify other parameters to the puppetmaster here #PUPPETMASTER_EXTRA_OPTS=--noca |