Posted over 7 years ago
How to get the mcollective-puppet-agent to run puppet in standalone/masterless mode
I just wanted to do a quick writeup on this since it took me about a day to figure out the issues and workarounds. Hopefully it will save someone else some time.
mcollective-puppet-agent is an mcollective plugin that allows you to (among other things) run puppet on a set of nodes. Out of the box, the plugin will execute
puppet agent --runonce on each node.
The puppet agent expects that you are running with a puppet master. We’re running in a masterless setup, so puppet agent isn’t a vaible way for us to initiate a puppet run.
With some guidance from ripienaar I was able to get this working.
The command to run puppet is configurable. My inital approach was simply to set this to
puppet apply instead of
puppet agent. The problem with this approach was the the mcollective-puppet plugin looks for pid files to determine the status of the puppet run. This works great since the puppet agent creates the pid files, but only in a traditional puppet infrastructure.
Puppet apply doesn’t run as a daemon. This is especially problamatic when you want to take advantage of the ‘runall’ feature of the plugin. The ‘runall’ feature allows you to run puppet on a set of nodes in such a way that only a certain number of concurrent runs are allowed at any given time (we use this for initiating rolling deploys). Since the pid file is not created during the puppet run, the plugin has no method to determine the number of instances that have a puppet run in progress.
puppet.command property to
/usr/sbin/daemonize -a -e /var/log/puppet/puppet.err -o /var/log/puppet/puppet.log -p /var/lib/puppet/state/agent_catalog_run.lock /usr/bin/puppet apply
Thanks again to ripienaar for being so available, patient, and helpful.