# handles puppetd service class puppetd( $master = false, $main_master = false, ) { include puppet case $puppetmaster_port { '': { $puppetmaster_port = "8140" } } case $puppetd_runinterval { '': { $puppetd_runinterval = "7200" } } case $puppetd_configtimeout { '': { $puppetd_configtimeout = "120" } } case $puppetd_server { '': { $puppetd_server = "puppet.$domain" } } case $puppetd_ensure { '': { $puppetd_ensure = $lsbdistcodename ? { 'squeeze' => '2.7.18-1~bpo60+1', default => installed, } } } package { "puppet-common": ensure => $puppetd_ensure, } package { "puppet": ensure => $puppetd_ensure, require => Package["cron", "puppet-common"], } file { "/etc/default/puppet": source => "puppet://$server/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" { $puppet_agent_name = 'puppetd' } else { $puppet_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://$server/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, } } }