# handles puppetd service class puppet::daemon( $master = false, $main_master = false, $ensure = hiera('puppet::daemon::ensure', ''), $port = hiera('puppet::daemon::port', "8140"), $runinterval = hiera('puppet::daemon::runinterval', "7200"), $configtimeout = hiera('puppet::daemon::configtimeout', "120"), $server = hiera('puppet::daemon::server', "puppet.${::domain}") ) { include puppet case $ensure { '': { $daemon_ensure = $::lsbdistcodename ? { 'squeeze' => '2.7.18-1~bpo60+1', default => installed, } } } package { "puppet-common": ensure => $daemon_ensure, } package { "puppet": ensure => $daemon_ensure, require => Package["cron", "puppet-common"], } file { "/etc/default/puppet": source => "puppet:///modules/puppet/puppet", owner => "root", group => "root", mode => 0644, ensure => present, notify => Service["puppet"], } service { "puppet": enable => true, ensure => running, hasrestart => true, require => [ Package["puppet"], File["/etc/default/puppet"] ], } # Name of puppet agent section in config file if $::puppetversion <= "0.25.4" { $agent_name = 'puppetd' } else { $agent_name = 'agent' } # Default config file for puppet nodes if ($master != true) or ($main_master != true) { file { "/etc/puppet/puppet.conf": ensure => file, owner => puppet, group => puppet, content => template("puppet/puppet-node.conf.erb"), } } else { file { "/etc/puppet/puppet.conf": ensure => file, owner => puppet, group => puppet, } } # Cron rule to restart puppet minutes after puppetmaster is restarted cron { "puppet-restart": command => "/etc/init.d/puppet restart > /dev/null 2>&1", user => root, hour => "*/1", minute => "10", ensure => absent, require => Service["puppet"], } file { "/usr/local/sbin/check-puppetd.sh": content => template("puppet/check-puppetd.sh.erb"), owner => "puppet", group => "puppet", mode => 0755, ensure => present, } cron { "puppetd-check": command => "/usr/local/sbin/check-puppetd.sh > /dev/null", user => root, hour => "*/1", minute => "0", require => File["/usr/local/sbin/check-puppetd.sh"], ensure => present, } # Thanks to https://labs.riseup.net/code/projects/shared-puppet file { "/etc/cron.d/puppetd": source => "puppet:///modules/puppet/cron.d/puppetd", owner => root, group => root, mode => 0644; } # Restore to original state after the following bug is addressed: # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=625626 if $::lsbdistcodename == 'squeeze' { file { "/etc/logrotate.d/puppetmaster": ensure => absent, } } }