intro to using mcollective - puppetconf 2014
DESCRIPTION
Intro to Using MCollective - Devon Peters, Jive SoftwareTRANSCRIPT
![Page 1: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/1.jpg)
Intro to MCollec,ve
![Page 2: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/2.jpg)
Orchestra,on?
![Page 3: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/3.jpg)
![Page 4: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/4.jpg)
h3ps://flic.kr/p/g5Z5TU
![Page 5: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/5.jpg)
Who am I?
![Page 6: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/6.jpg)
![Page 7: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/7.jpg)
![Page 8: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/8.jpg)
![Page 9: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/9.jpg)
![Page 10: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/10.jpg)
![Page 11: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/11.jpg)
![Page 12: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/12.jpg)
![Page 13: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/13.jpg)
![Page 14: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/14.jpg)
![Page 15: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/15.jpg)
h3ps://flic.kr/p/5F1BfM
![Page 16: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/16.jpg)
h3ps://flic.kr/p/3t5WV
![Page 17: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/17.jpg)
h3ps://flic.kr/p/6rTurs
![Page 18: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/18.jpg)
h3ps://flic.kr/p/nvAJDP
![Page 19: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/19.jpg)
![Page 20: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/20.jpg)
![Page 21: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/21.jpg)
Agents == Sheet Music
![Page 22: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/22.jpg)
h3ps://flic.kr/p/4oxUMc
![Page 23: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/23.jpg)
"SchaRerdeInKoeln" by Túrelio -‐ Own work. Licensed under Crea,ve Commons A3ribu,on-‐Share Alike 2.5 via Wikimedia Commons -‐ h3p://commons.wikimedia.org/wiki/File:SchaRerdeInKoeln.jpg#mediaviewer/File:SchaRerdeInKoeln.jpg
![Page 24: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/24.jpg)
![Page 25: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/25.jpg)
![Page 26: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/26.jpg)
h3ps://flic.kr/p/dZMbgg
![Page 27: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/27.jpg)
![Page 28: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/28.jpg)
![Page 29: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/29.jpg)
Filters == Find a Sec4on
![Page 30: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/30.jpg)
Pu^ng it into ac,on
![Page 31: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/31.jpg)
![Page 32: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/32.jpg)
S,ll not quite the Orchestra
![Page 33: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/33.jpg)
A way to achieve that…
![Page 34: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/34.jpg)
#!/bin/bash -e for node in $(mco find --np -C roles::node)
do
echo "restarting ssh on $node"
mco service --np sshd restart -I $node >/dev/null
sleep 2
mco rpc service status service=sshd -I $node -j | \
grep "status.*running" >/dev/null 2>&1
echo "ssh is up on $node" done
![Page 35: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/35.jpg)
#!/usr/bin/ruby
require 'mcollective' include MCollective::RPC
util = rpcclient("rpcutil")
util.progress = false util.class_filter /roles::node/ nodes = []
util.ping.each do |resp| nodes << resp[:sender]
end util.disconnect
status = "" nodes.each do |node| srv = rpcclient("service")
srv.progress = false srv.identity_filter node
puts "restarting sshd on #{node}" srv.restart(:service => "sshd") srv.reset
i = 0
while i < 3 do srv.status(:service => "sshd").each do |resp| status = resp[:data][:status]
end if status == "running"
break end srv.reset
sleep 1 i += 1
end if status != "running"
puts "failed to restart sshd" exit 1
end
puts "ssh is up #{node}" end
![Page 36: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/36.jpg)
Just some info…
NO DEMO
![Page 37: Intro to Using MCollective - PuppetConf 2014](https://reader033.vdocuments.us/reader033/viewer/2022051412/549c65f3b47959f3318b4726/html5/thumbnails/37.jpg)
Ques,ons?
BTW -‐ Demo brought to you by h3ps://github.com/ripienaar/mcollec,ve-‐vagrant, check it out.
Also, thank you R.I. Pienaar.