mcollective » History » Revision 1
Revision 1/13
| Next »
Laurent Domb, 04/30/2013 03:24 PM
mcollective¶
As adding support for mCollective is currently a work in progress [[ http://projects.theforeman.org/projects/1/wiki/MCollective_integration ]] and primarily focused around the smart-proxy, this how to can change at any time.
Mcollective, Foreman and Puppet PE¶
As puppet PE comes with mcollective it's fairly easy to make it work with the foreman smart proxy. Sam Kottler wrote a patch (https://github.com/theforeman/smart-proxy/pull/58/files) to integrate mcollective and foreman-proxy.
I assume you have followed the guide passenger on Puppet PE . If so you need to replace, create and edit the following files:
/usr/share/foreman-proxy/config/settings.yml /usr/share/foreman-proxy/lib/proxy/puppet.rb /usr/share/foreman-proxy/lib/proxy/puppet/runner.rb /usr/share/foreman-proxy/lib/puppet_api.rb
In /usr/share/foreman-proxy/config/settings add the following line after the puppet management entry:
# enable MCollective integration :mcollective: false
Then replace puppet.rb and puppet_api.rb
# rm -f /usr/share/foreman-proxy/lib/proxy/puppet.rb # cd /usr/share/foreman-proxy/lib/proxy/ # wget https://raw.github.com/skottler/smart-proxy/2a7b5fbfcdb3a0e9a4b22d46a09d4bfa2aa0f765/lib/proxy/puppet.rb # rm -f /usr/share/foreman-proxy/lib/puppet_api.rb # cd /usr/share/foreman-proxy/lib/ # wget https://raw.github.com/skottler/smart-proxy/2a7b5fbfcdb3a0e9a4b22d46a09d4bfa2aa0f765/lib/puppet_api.rb
The 4th script runner.rb needs a little bit more attention as puppet pe 2.7.2 does not use the mcollective agent puppet. It uses puppetd. Also to be able to query the hosts, all the mcollective commands need to be running in the peadmin user environment.
# cd /usr/share/foreman-proxy/lib/proxy/puppet/ # wget https://raw.github.com/skottler/smart-proxy/2a7b5fbfcdb3a0e9a4b22d46a09d4bfa2aa0f765/lib/proxy/puppet/runner.rb
Modify the runner.rb file on line 8 and line 16:
1 module Proxy::Puppet 2 class Mcollective 3 extend Proxy::Util 4 5 def self.run(nodes) 6 mco_search_path = ["/usr/bin", "/opt/puppet/bin"] 7 sudo = which("sudo", "usr/bin") 8 sudo = sudo << " -u peadmin" 9 mco = which("mco", mco_search_path) 10 11 unless sudo and mco 12 logger.warn "sudo or the mco binary is missing." 13 return false 14 end 15 16 mco << " puppetd runonce -I #{nodes}"
Mcollective sudo¶
Create an mcollective sudoers file to allow the foreman proxy to execute mco commands.
Defaults:foreman-proxy !requiretty foreman-proxy ALL=(peadmin) NOPASSWD: /opt/puppet/bin/mco *
Updated by Laurent Domb over 11 years ago · 13 revisions