This document introduces Fabric, an automation tool written in Python that allows users to execute commands on remote servers. It provides an overview of what Fabric is, why it was created, its prerequisites, and how to get started using its core functionality through demos and examples. Key benefits highlighted are that Fabric allows automation with less code than shell scripts and mistakes than manual work, while also reducing the time needed to manage multiple servers. Alternatives like Ansible, Salt, Puppet and Chef are briefly discussed and why Fabric may be preferable for certain use cases.
7. Fabric's Good Points
Less codes than shell scripts
Less mistakes than handwork
Less time to operate many servers
8. Pre Requisites
Python 2.5+
Python-setuptools (optional but preferred)
Pip
easy_install (in case you dont use 'pip')
gcc
9. Fabric's Basics
Install
$ pip install fabric
Setting
$ make fabfile.py
Run
$ fab <Option><Fab file>
10. Fabric API's
Core API
Sudo
Run
Color output functions
Network
Context Managers
Contrib API
User I/O
Modifying remote files
Django Integration
11. Core Functionality
local() - Run commands locally
Run() - Run command remotely
Sudo() - Run a command remotely as another
user
Put() - Copy a file from local to remote
Get() - Copy a file from remote to local
13. Why not others?
1. Ansible is not supported on windows
2. Ansible is for larger deployments unlike fabric
3. Salt does not deal with interactivity
4. Salt eats your logs giving you a very small
feedback (states/module outputs)
5. Puppet: Solid knowledge of Ruby is highly
recommended
6. Chef: Not 'complete' as compared to puppet