Fabric, one to rule them all

Thanks to iMil I recently discovered about Fabric. Fabric is a powerful python utility allowing you to manage plenty of machines across your LAN. I started experimenting on a few boxes, Debian and CentOS based at the moment, so here’s the dependencies just in case you need them.
Debian:

apt-get install python-setuptools python-crypto

CentOS:

yum install -y python-setuptools.noarch python-crypto

Then download the latest version of fabric and unpack and install:

python setup.py install

There you are, ready to control them all, here’s a quick example, let’s name it fab-uname.py :

from fabric.api import run

def uname();
run (‘uname -a’)

To execute, imagine you have node0{1,2,3,4}, you can then do fab -f fab-uname.py -H node01,node02,node03,node04 uname