Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Intro to Using MCollective - PuppetConf 2014

1,277 views

Published on

Intro to Using MCollective - Devon Peters, Jive Software

Published in: Technology
  • Be the first to comment

Intro to Using MCollective - PuppetConf 2014

  1. 1. Intro to MCollec,ve
  2. 2. Orchestra,on?
  3. 3. h3ps://flic.kr/p/g5Z5TU
  4. 4. Who am I?
  5. 5. h3ps://flic.kr/p/5F1BfM
  6. 6. h3ps://flic.kr/p/3t5WV
  7. 7. h3ps://flic.kr/p/6rTurs
  8. 8. h3ps://flic.kr/p/nvAJDP
  9. 9. Agents == Sheet Music
  10. 10. h3ps://flic.kr/p/4oxUMc
  11. 11. "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
  12. 12. h3ps://flic.kr/p/dZMbgg
  13. 13. Filters == Find a Sec4on
  14. 14. Pu^ng it into ac,on
  15. 15. S,ll not quite the Orchestra
  16. 16. A way to achieve that…
  17. 17. #!/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
  18. 18. #!/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]
  19. 19. Just some info… NO DEMO
  20. 20. Ques,ons? BTW -­‐ Demo brought to you by h3ps://github.com/ripienaar/mcollec,ve-­‐vagrant, check it out. Also, thank you R.I. Pienaar.

×