From 931f021a1fe45636aec3b5332848dd912425affe Mon Sep 17 00:00:00 2001 From: varac Date: Fri, 6 Jul 2012 16:20:50 +0000 Subject: notify_passenger_puppetmaster: do apache2 reload instead of touching .../restart.txt, which doen't seem to work with libapache2-mod-passenger 2.2.11debian-2 --- manifests/puppetmaster/linux.pp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/manifests/puppetmaster/linux.pp b/manifests/puppetmaster/linux.pp index 2670203..31f8853 100644 --- a/manifests/puppetmaster/linux.pp +++ b/manifests/puppetmaster/linux.pp @@ -3,7 +3,8 @@ class puppet::puppetmaster::linux inherits puppet::linux { if $puppetmaster_mode == 'passenger' { exec { 'notify_passenger_puppetmaster': refreshonly => true, - command => 'touch /etc/puppet/rack/tmp/restart.txt && sleep 1 && rm /etc/puppet/rack/tmp/restart.txt', + #command => 'touch /etc/puppet/rack/tmp/restart.txt && sleep 1 && rm /etc/puppet/rack/tmp/restart.txt', + command => '/etc/init.d/apache2 reload', } } else { service { 'puppetmaster': -- cgit v1.2.3 From b5bbca3a198612fbf0ee6232875e1d4d08902ef6 Mon Sep 17 00:00:00 2001 From: varac Date: Fri, 6 Jul 2012 16:24:04 +0000 Subject: added puppetmaster service def. for passenger --- manifests/puppetmaster/linux.pp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/manifests/puppetmaster/linux.pp b/manifests/puppetmaster/linux.pp index 31f8853..26f67fe 100644 --- a/manifests/puppetmaster/linux.pp +++ b/manifests/puppetmaster/linux.pp @@ -6,6 +6,15 @@ class puppet::puppetmaster::linux inherits puppet::linux { #command => 'touch /etc/puppet/rack/tmp/restart.txt && sleep 1 && rm /etc/puppet/rack/tmp/restart.txt', command => '/etc/init.d/apache2 reload', } + + service { 'puppetmaster': + ensure => running, + pattern => 'apache2', + hasstatus => true, + hasrestart => true, + require => [ Package[puppet] ], + } + } else { service { 'puppetmaster': ensure => running, -- cgit v1.2.3 From bc1a9682ada5040c163ba4508e13b757219d1698 Mon Sep 17 00:00:00 2001 From: varac Date: Tue, 17 Jul 2012 15:53:58 -0700 Subject: Temporarily disabled Package['puppetmaster'] otherwise you now get following error: err: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find resource(s) Package[puppetmaster] for overriding on node flea.leap.se see https://leap.se/code/issues/198 --- manifests/puppetmaster/package/debian.pp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/puppetmaster/package/debian.pp b/manifests/puppetmaster/package/debian.pp index 33d7d5e..21407bb 100644 --- a/manifests/puppetmaster/package/debian.pp +++ b/manifests/puppetmaster/package/debian.pp @@ -1,6 +1,6 @@ class puppet::puppetmaster::package::debian inherits puppet::puppetmaster::package { - Package['puppetmaster']{ - require => Package['puppetmaster-common'] - } + #Package['puppetmaster']{ + # require => Package['puppetmaster-common'] + #} } -- cgit v1.2.3 From 65af9e370b43b8959356d116f17607125a1f7733 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Thu, 9 Aug 2012 16:03:01 -0400 Subject: Because passenger mode doesn't have its own daemon, it was a hack before to have the service definition for 'puppetmaster' be actually looking in the process list for 'apache2'. This sort of worked, but not if you need to notify the service for a restart. It also didn't actually work, because the hasstatus parameter was set to true, which meant that on every run, puppet did a /etc/init.d/puppetmaster status and found that it was not running and then tried to start it by doing /etc/init.d/puppetmaster start. That doesn't work because its turned off in /etc/default/puppetmaster when puppetmaster_mode='passenger'. So... this commit removes that hacky service definition and instead just requires the apache::base class, providing the apache service monitoring that is needed when you are running puppetmaster_mode='passenger'. It also has to pull up the Service[puppet] override which was adding the puppetmaster service, which makes no sense because there is no service. Finally, in order to notify it for changes, we need to use a selector to determine how to reload things based on puppetmaster_mode. --- manifests/puppetmaster/debian.pp | 5 ++++- manifests/puppetmaster/linux.pp | 17 ++++++----------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/manifests/puppetmaster/debian.pp b/manifests/puppetmaster/debian.pp index 8cee0ea..853a0e6 100644 --- a/manifests/puppetmaster/debian.pp +++ b/manifests/puppetmaster/debian.pp @@ -13,7 +13,10 @@ class puppet::puppetmaster::debian inherits puppet::puppetmaster::package { "puppet:///modules/site-puppet/master/debian/${domain}/puppetmaster", "puppet:///modules/site-puppet/master/debian/puppetmaster", "puppet:///modules/puppet/master/debian/puppetmaster" ], - notify => Service[puppetmaster], + notify => $puppetmaster_mode ? { + 'passenger' => Exec['notify_passenger_puppetmaster'], + default => Service[puppetmaster], + }, owner => root, group => 0, mode => 0644; } } diff --git a/manifests/puppetmaster/linux.pp b/manifests/puppetmaster/linux.pp index 26f67fe..7c2e428 100644 --- a/manifests/puppetmaster/linux.pp +++ b/manifests/puppetmaster/linux.pp @@ -1,28 +1,23 @@ class puppet::puppetmaster::linux inherits puppet::linux { if $puppetmaster_mode == 'passenger' { + + require('apache::base') + exec { 'notify_passenger_puppetmaster': refreshonly => true, #command => 'touch /etc/puppet/rack/tmp/restart.txt && sleep 1 && rm /etc/puppet/rack/tmp/restart.txt', command => '/etc/init.d/apache2 reload', } - service { 'puppetmaster': - ensure => running, - pattern => 'apache2', - hasstatus => true, - hasrestart => true, - require => [ Package[puppet] ], - } - } else { service { 'puppetmaster': ensure => running, enable => true, require => [ Package[puppet] ], } - } - Service[puppet]{ - require +> Service[puppetmaster], + Service[puppet]{ + require +> Service[puppetmaster], + } } } -- cgit v1.2.3 From 04d8317eb5b70aba62c2b18f6b1bd1d03aedeb5b Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Fri, 10 Aug 2012 12:32:29 -0400 Subject: Fix puppet attempting to change the puppet service from 'stopped' to running on each run: notice: /Stage[main]/Puppet::Base/Service[puppet]/ensure: ensure changed 'stopped' to 'running' When running in cron mode, you do not want the puppet service enabled, nor do you want it 'running'. When enabling the cron mode, the first part of puppet::cron::base does a Service override on the puppet service to set enable => false. That is a good thing, but all it does is make the service setup so it wont be run on boot. Unfortunately, the puppet service definition also has a 'ensure => running' which does an /etc/init.d/puppet status and then starts the service if it is not running. In a cron-only setup, the 'status' command results in a failure, because the daemon is not running, and then puppet attempts to start it, which goes nowhere because the /etc/default/puppet is configured not to start. So, looking further at puppet::cron::base we see there is a case switch, testing on operatingsystem and if its debian/ubuntu (or openbsd) it falls out of the case. If it is not one of those, it continues and does a test to see if the version of puppet is 2.6 and if so then it does an additional puppet Service override to set ensure=> stopped which keeps the service from being checked to see if it is running, and if it is not starting it. So to fix this, we remove debian/ubuntu from the case, so it will continue through and then we change the $puppet_majorversion test to look for anything greater than or equal to '2.6', since 2.7 and later are also versions we want this to work with. After this change, we no longer get the attempt to restart puppet on every run. --- manifests/cron/base.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/cron/base.pp b/manifests/cron/base.pp index 7daa6fb..5c7a708 100644 --- a/manifests/cron/base.pp +++ b/manifests/cron/base.pp @@ -6,12 +6,12 @@ class puppet::cron::base inherits puppet::base { } case $operatingsystem { - debian,openbsd,ubuntu: { + openbsd: { #it's already disabled } default: { $puppet_majorversion = regsubst($puppetversion,'^(\d+\.\d+).*$','\1') - if $puppet_majorversion == '2.6' { + if $puppet_majorversion >= '2.6' { Service['puppet']{ ensure => stopped, } -- cgit v1.2.3 From 8d8ef7b1965bd0c72e2755da71d3cbcc9e4d09ad Mon Sep 17 00:00:00 2001 From: varac Date: Tue, 14 Aug 2012 00:01:04 +0200 Subject: debian specific config.ru location for use with puppetmaster-passenger package --- manifests/puppetmaster/passenger.pp | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/manifests/puppetmaster/passenger.pp b/manifests/puppetmaster/passenger.pp index c4bc062..37f4fef 100644 --- a/manifests/puppetmaster/passenger.pp +++ b/manifests/puppetmaster/passenger.pp @@ -7,14 +7,26 @@ class puppet::puppetmaster::passenger inherits puppet::puppetmaster::base { # A reference configuration is available at : # http://github.com/reductivelabs/puppet/tree/master/ext/rack - file { - ['/etc/puppet/rack', '/etc/puppet/rack/public', '/etc/puppet/rack/tmp']: - ensure => directory, - owner => root, group => 0, mode => 0755; + case $operatingsystem { + debian: { + package { 'puppetmaster-passenger': ensure => installed } + file { + '/usr/share/puppet/rack/puppetmasterd/config.ru': + source => [ 'puppet:///modules/site-puppet/master/config.ru', + 'puppet:///modules/puppet/master/config.ru' ], + owner => puppet, group => 0, mode => '0644'; + } + } + default: { + file { + ['/etc/puppet/rack', '/etc/puppet/rack/public', '/etc/puppet/rack/tmp']: + ensure => directory, + owner => root, group => 0, mode => '0755'; - '/etc/puppet/rack/config.ru': - source => [ "puppet:///modules/site-puppet/master/config.ru", - "puppet:///modules/puppet/master/config.ru" ], - owner => puppet, group => 0, mode => 0644; - } + '/etc/puppet/rack/config.ru': + source => [ 'puppet:///modules/site-puppet/master/config.ru', + 'puppet:///modules/puppet/master/config.ru' ], + owner => puppet, group => 0, mode => '0644'; + } + } } -- cgit v1.2.3 From dcf1036eb3b8f8d90eef208dd7766b1602b2b2e3 Mon Sep 17 00:00:00 2001 From: varac Date: Tue, 14 Aug 2012 00:10:50 +0200 Subject: forgot closing brace --- manifests/puppetmaster/passenger.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/manifests/puppetmaster/passenger.pp b/manifests/puppetmaster/passenger.pp index 37f4fef..9f4d1e8 100644 --- a/manifests/puppetmaster/passenger.pp +++ b/manifests/puppetmaster/passenger.pp @@ -29,4 +29,5 @@ class puppet::puppetmaster::passenger inherits puppet::puppetmaster::base { owner => puppet, group => 0, mode => '0644'; } } + } } -- cgit v1.2.3