As banyek mentioned in his post we love ansible and we use it as an addition to puppet to manage all bits and pieces of our infrastructure. Over the time we built some advanced playbooks to deploy kinja to our app servers, rebuild mysql slaves, failover mysql masters, etc.

And of course I love to use the shell module from my console to run various stuff on our pools. In the old days I've used to use something like this:

for i in 01 02 03 04 05 06 07 08 09 10 11 12; do ssh app$i "curl http://a.com/a.sh > /tmp/a.sh"; done

Advertisement

with ansible you can do this:

ansible app-pool -m shell -a "curl http://a.com/a.sh > /tmp/a.sh"

or there is a module for that:

ansible app-pool -m get_url -a "url=http://a.com/a.sh dest=/tmp/a.sh"

I think using ansible is shorter and cleaner than the shell-foo, but I always forgot the names of the groups in our hosts file and there is no chance I can remember the parameters of all the modules or even the name of the available modules.

Ansible-shell is an interactive shell for ansible, it maps your hosts file and the available modules so you can use tab to complete the names/params.

Advertisement

[dominis@cobbler.bfc ~]$ ansible-shell Welcome to the ansible-shell. Type help or ? to list commands.dominis@/[s:2]$ list app01.bfc.kinja.com app01.xyz.kinja-ops.com app02.bfc.kinja.com app02.xyz.kinja-ops.com app03.bfc.kinja.com app03.xyz.kinja-ops.com app04.bfc.kinja.com ... dominis@/[s:2]$ cd app-pool dominis@/app-pool (12)[s:2]$ date app12.bfc.kinja.com Mon Jul 1 10:53:05 EDT 2013 app04.bfc.kinja.com Mon Jul 1 10:53:01 EDT 2013 app07.bfc.kinja.com Mon Jul 1 10:53:02 EDT 2013 app06.bfc.kinja.com Mon Jul 1 10:53:02 EDT 2013 app08.bfc.kinja.com Mon Jul 1 10:53:02 EDT 2013 app10.bfc.kinja.com Mon Jul 1 10:53:03 EDT 2013 app11.bfc.kinja.com Mon Jul 1 10:53:05 EDT 2013 app09.bfc.kinja.com Mon Jul 1 10:53:03 EDT 2013 app05.bfc.kinja.com Mon Jul 1 10:53:02 EDT 2013 app01.bfc.kinja.com Mon Jul 1 10:53:00 EDT 2013 app03.bfc.kinja.com Mon Jul 1 10:53:01 EDT 2013 app02.bfc.kinja.com Mon Jul 1 10:53:00 EDT 2013

magic:

dominis@/app-pool (12)[s:2]$

Available commands:

  • list - lists the nodes under you current pool
  • cd - changes the current pool
  • serial N - sets the serial
  • ! - forces the shell module (try ping kinja.com vs. !ping kinja.com)

You can install it via pip or just clone the git repo and run the script. Please report any bugs or request features in the repo's issue tracker on github, if you want fork the project and hack it.