From its web: “Fabric is a Python library and command-line tool for streamlining the use of SSH for application deployment or systems administration tasks. More specifically, Fabric is:
- A tool that lets you execute arbitrary Python functions via the command line;
- A library of subroutines (built on top of a lower-level library) to make executing shell commands over SSH easy and Pythonic.
Naturally, most users combine these two things, using Fabric to write and execute Python functions, or tasks, to automate interactions with remote servers.”
Installation:
- Download the package from here
- Install it:
sudo dpkg -i fabric*.deb
Use::
- Follow this short tutorial to learn the basics.
- Create a file called fabfile.py
- Fill it with your customized functions. For Example:
from fabric.api import env, run, sudo
env.hosts = ['ubuntu1', 'ubuntu2', 'ubuntu3']
def upgrade_hosts():
sudo('apt-get update && apt-get dist-upgrade ')
- Run fabric:
fab upgrade_hosts
I find Fabric very useful and time-saving when maintaining similar servers, because you can design a task and run it automatically on all the servers.