11

I use puppet to manage linux servers and various services. It works well, except for the puppet service itself.

My puppet class is like this :

class puppet {
  file { "/etc/puppet/puppet.conf":
    owner  => 0, group  => 0, mode => 0644,
    content => template("${module_name}/puppet.conf.erb"),
  }

  service { "puppet":
    name       => "puppet",
    ensure     => running,
    enable     => true, hasstatus  => true, hasrestart => true,
    require    => File["/etc/puppet/puppet/conf"]
    subscribe  => File["/etc/puppet/puppet/conf"]
  }
}

}

When a change is applied on /etc/puppet/puppet.conf, puppet notices that it needs to restart puppet service and so, crash itself :

Mar 30 17:08:23 XXXX puppet-agent[20172]: (/Stage[main]/Puppet/File[/etc/puppet/puppet.conf]/content) content changed '{md5}eeaf5dfc7d88c8d9c85e6a8cc714d702' to '{md5}ef6ff0e423f4125e24b689980df9f71d'
Mar 30 17:08:23 XXXX puppet-agent[20172]: Caught TERM; calling stop

Do you know how I could update puppet.conf correctly with puppet ?

2 Answers 2

10

The puppet daemon will automatically notice changes to the puppet.conf file without needing to be restarted. Simply remove the subscribe => File["/etc/puppet/puppet.conf"] from service { "puppet" ... } and everything will still work.

Puppet can't really ensure => running for itself, either. Using something like the Mutal Restart with puppet ensuring cron is running and a cronjob ensuring puppet is running will work, however.

1
  • I'll check if it works on monday, but it seems very good to me. Thanks for the pointer about Mutual Restart.
    – Coren
    Mar 31, 2012 at 9:43
1

One solution is to not run puppet as a daemon, but invoke it from cron. This something that many people prefer because for them, the daemon consumes a lot of memory.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .