Howto integrate Puppet, Foreman and Mcollective
Since we deployed Foreman in production, we didn’t use the ‘Run puppet’ button
in Foreman’s interface because we run puppet with a crontab.
However Foreman 1.2 release changed that : now smart-proxy have
mcollective native integration.
This is how to setup that. I assume that you already have a working Foreman and Mcollective
setup.
In all your ‘puppet’ proxies you need to :
Install mcollective client and puppet plugin:
# apt-get install mcollective-client mcollective-puppet-client
You need to configure you mcollective client (/etc/mcollective/client.cfg). This configuration should be
quite similar to the one you have for your desktop.
You need then to grant the user foreman-proxy to run mcollective client :
# visudo Defaults:foreman-proxy !requiretty foreman-proxy ALL = NOPASSWD: /usr/bin/mco puppet runonce *
In your proxy configuration :
:puppet: true :puppet_provider: mcollective
Restart then your smart-proxy (I run it with apache/passenger):
# service apache2 restart
You should be able to test your new installation with a simple
curl command :
$ curl -d "nodes=myserver.example.com" https://myproxy:8443/puppet/run
In order to be able to use the mcollective integration, I had to add in my mcollective daemon
configuration the following directive :
Dans /etc/mcollective/server.cfg
identity = myserver.example.com
Eventualy in Foreman settings, you
need to set ‘puppetrun’ directive to ‘true’:
This should be good: you just need to click on ‘Run puppet’ button on your host page !