mcollective » History » Version 3
Laurent Domb, 04/30/2013 03:31 PM
1 | 1 | Laurent Domb | h1. mcollective |
---|---|---|---|
2 | |||
3 | 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. |
||
4 | |||
5 | h2. Mcollective, Foreman and Puppet PE |
||
6 | |||
7 | 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. |
||
8 | |||
9 | 3 | Laurent Domb | I assume you have followed the guide [[ passenger on Puppet PE and use foreman as an ENC and reporting engine ]]. If so you need to replace, create and edit the following files: |
10 | 1 | Laurent Domb | |
11 | <pre> |
||
12 | /usr/share/foreman-proxy/config/settings.yml |
||
13 | /usr/share/foreman-proxy/lib/proxy/puppet.rb |
||
14 | /usr/share/foreman-proxy/lib/proxy/puppet/runner.rb |
||
15 | /usr/share/foreman-proxy/lib/puppet_api.rb |
||
16 | </pre> |
||
17 | |||
18 | In /usr/share/foreman-proxy/config/settings add the following line after the puppet management entry: |
||
19 | |||
20 | <pre> |
||
21 | # enable MCollective integration |
||
22 | :mcollective: false |
||
23 | </pre> |
||
24 | |||
25 | 2 | Laurent Domb | Now your puppet pe / foreman installation is ready for a puppet run via foreman host page. |
26 | |||
27 | 1 | Laurent Domb | Then replace puppet.rb and puppet_api.rb |
28 | <pre> |
||
29 | # rm -f /usr/share/foreman-proxy/lib/proxy/puppet.rb |
||
30 | # cd /usr/share/foreman-proxy/lib/proxy/ |
||
31 | # wget https://raw.github.com/skottler/smart-proxy/2a7b5fbfcdb3a0e9a4b22d46a09d4bfa2aa0f765/lib/proxy/puppet.rb |
||
32 | # rm -f /usr/share/foreman-proxy/lib/puppet_api.rb |
||
33 | # cd /usr/share/foreman-proxy/lib/ |
||
34 | # wget https://raw.github.com/skottler/smart-proxy/2a7b5fbfcdb3a0e9a4b22d46a09d4bfa2aa0f765/lib/puppet_api.rb |
||
35 | </pre> |
||
36 | |||
37 | 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. |
||
38 | |||
39 | <pre> |
||
40 | # cd /usr/share/foreman-proxy/lib/proxy/puppet/ |
||
41 | # wget https://raw.github.com/skottler/smart-proxy/2a7b5fbfcdb3a0e9a4b22d46a09d4bfa2aa0f765/lib/proxy/puppet/runner.rb |
||
42 | </pre> |
||
43 | |||
44 | Modify the runner.rb file on line 8 and line 16: |
||
45 | |||
46 | <pre> |
||
47 | 1 module Proxy::Puppet |
||
48 | 2 class Mcollective |
||
49 | 3 extend Proxy::Util |
||
50 | 4 |
||
51 | 5 def self.run(nodes) |
||
52 | 6 mco_search_path = ["/usr/bin", "/opt/puppet/bin"] |
||
53 | 7 sudo = which("sudo", "usr/bin") |
||
54 | 8 sudo = sudo << " -u peadmin" |
||
55 | 9 mco = which("mco", mco_search_path) |
||
56 | 10 |
||
57 | 11 unless sudo and mco |
||
58 | 12 logger.warn "sudo or the mco binary is missing." |
||
59 | 13 return false |
||
60 | 14 end |
||
61 | 15 |
||
62 | 16 mco << " puppetd runonce -I #{nodes}" |
||
63 | </pre> |
||
64 | |||
65 | h3. Mcollective sudo |
||
66 | |||
67 | Create an mcollective sudoers file to allow the foreman proxy to execute mco commands. |
||
68 | |||
69 | <pre> |
||
70 | Defaults:foreman-proxy !requiretty |
||
71 | foreman-proxy ALL=(peadmin) NOPASSWD: /opt/puppet/bin/mco * |
||
72 | </pre> |