Joe Miller bio photo

Joe Miller

Ops/Engineering. Continuous DevOping at Webscale

Twitter Github

Use mc-shellcmd to run any command on the nodes in your collective, eg:

$ mc-shellcmd 'echo I execute therefore I am'
===============================================================
web01.example.com exitcode: 0, output:
I execute therefore I am
===============================================================
web02.example.com exitcode: 0, output:
I execute therefore I am
===============================================================
web03.example.com exitcode: 0, output:
I execute therefore I am
===============================================================
db01.example.com exitcode: 0, output:
I execute therefore I am
===============================================================


Finished processing 4 / 4 hosts in 221.02 ms

I have been experimenting recently with mcollective in my environment.  If you’re not familiar with mcollective it is a “framework to build server orchestration or parallel job execution systems.”

The simplest way to explain it is that mcollective is “SSH for-loop 2.0” or “next-gen clusterSSH”, but that doesn’t do enough justice to how powerful mcollective is likely to become.  Check out R.I.Pienaar’s automated mcollective-server-provisioner to see a great example of mcollective’s power and potential to be a revolutionary platform as systems administration moves from the age of managing stable, fixed assets into managing flexible, dynamic building blocks (ie: devOps.)

I still find myself needing to do ad-hoc commands on many hosts as quickly as possible.  I still use Capistrano to do most of this, but I also wanted to be able to run arbitrary commands via mcollective.  Thus, shellcmd-agent was born.

BEWARE!  This is a powerful agent.  Anyone with access to your mcollective message bus can run any command as root on your servers.

You can find the code and documentation on github: http://github.com/joemiller/shellcmd-agent