diff options
-rw-r--r-- | manifests/master/update.pp | 7 | ||||
-rw-r--r-- | manifests/puppetd.pp | 8 | ||||
-rw-r--r-- | manifests/puppetmasterd.pp | 39 |
3 files changed, 31 insertions, 23 deletions
diff --git a/manifests/master/update.pp b/manifests/master/update.pp index f650482..ddc8ba1 100644 --- a/manifests/master/update.pp +++ b/manifests/master/update.pp @@ -1,5 +1,6 @@ class puppet::master::update( - $method = hiera('puppet::master::update::method', 'cron') + $ensure = present, + $method = hiera('puppet::master::update::method', 'cron') ) { # puppet update script file { "/usr/local/sbin/update-puppet-conf.sh": @@ -16,7 +17,7 @@ class puppet::master::update( user => puppet, minute => "*/5", ensure => $method ? { - 'cron' => present, + 'cron' => $ensure, default => absent, }, require => [ File["/usr/local/sbin/update-puppet-conf.sh"], User["puppet"] ], @@ -28,7 +29,7 @@ class puppet::master::update( owner => gitolite, group => gitolite, ensure => $method ? { - 'cron' => absent, + 'cron' => $ensure, default => present, }, source => "puppet:///modules/puppet/post-update.sh", diff --git a/manifests/puppetd.pp b/manifests/puppetd.pp index 0d5a8bb..62aad13 100644 --- a/manifests/puppetd.pp +++ b/manifests/puppetd.pp @@ -1,5 +1,9 @@ # handles puppetd service -class puppetd inherits puppet { +class puppetd( + $master = false, + $main_master = false, +) { + include puppet case $puppetmaster_port { '': { $puppetmaster_port = "8140" } @@ -59,7 +63,7 @@ class puppetd inherits puppet { } # default config file for puppet nodes - if ($puppetmasterd_present != true) or ($main_master != true) { + if ($master != true) or ($main_master != true) { file { "/etc/puppet/puppet.conf": ensure => file, owner => puppet, diff --git a/manifests/puppetmasterd.pp b/manifests/puppetmasterd.pp index aa428d5..122f1dd 100644 --- a/manifests/puppetmasterd.pp +++ b/manifests/puppetmasterd.pp @@ -1,5 +1,7 @@ # handles puppetmasterd service -class puppetmasterd { +class puppetmasterd( + $main => false, +) { # Configuration case $puppetmaster_servertype { @@ -27,11 +29,11 @@ class puppetmasterd { include puppetmaster::ca } - # warns that this node has a puppetmaster - $puppetmasterd_present = true - # then include puppet class - include puppetd + class { 'puppetd': + master => true, + main_master => $main, + } # needed packages package { @@ -53,7 +55,10 @@ class puppetmasterd { default: { service { "puppetmaster": enable => true, - ensure => running, + ensure => $main ? { + true => running, + default => stopped, + }, hasrestart => true, pattern => 'puppet master', require => Package['puppetmaster'], @@ -117,7 +122,12 @@ class puppetmasterd { } # update config - class { 'puppet::master::update': } + class { 'puppet::master::update': + ensure => $main ? { + true => present, + default => absent, + }, + } # custom puppetlast command, thanks to immerda module: # http://git.puppet.immerda.ch/?p=module-puppet.git;a=summary @@ -126,7 +136,10 @@ class puppetmasterd { # https://labs.riseup.net/code/issues/2515 file { "/usr/local/sbin/puppetlast": source => "puppet:///modules/puppet/lastruncheck", - ensure => absent, + ensure => $main ? { + true => absent, + default => absent, + }, owner => root, group => root, mode => 0700, @@ -148,13 +161,3 @@ class puppetmasterd { #} } - -class puppetmasterd::disabled inherits puppetmasterd { - Service["puppetmaster"] { - ensure => stopped, - } - - Cron["puppetlast", "puppetmaster-restart", "puppet-update"] { - ensure => absent, - } -} |