fabric
Execute commands on remote systems
TLDR
Run the setup to configure fabric
List all available patterns
Run a pattern with input from a file
Run a pattern on a YouTube video URL
Chain patterns together by piping output from one to another
Run a custom user-defined pattern
Run a pattern and save the output to a file
Run a pattern with the specified variables
SYNOPSIS
fab [options] [task [arg1 arg2 ...] ...]
PARAMETERS
-h, --help
Show this help message and exit
-V, --version
Show program's version number and exit
-l, --list
List available tasks with descriptions
-d TASK, --display TASK
Display detailed help for specific task
-r, --dry-run
Print actions without executing
--graph
Print task dependency callgraph
-c CONFIG, --config-file CONFIG
Load config file(s); repeatable
--fabfile PATH
Path to fabfile (default: fabfile.py)
--hosts HOSTS
Override hosts from fabfile
--ssh-config PATH
Custom SSH config file
DESCRIPTION
Fabric is a Python library and CLI tool for simplifying SSH-based tasks like deployments, configurations, and admin work. Users define reusable tasks in a fabfile.py Python script, executed via the fab command (fabric in some setups). It handles connections, sudo, file transfers, and parallel execution across hosts or roles.
Unlike full CM tools like Ansible, Fabric offers lightweight, Python-scriptable automation with native shell integration. Fabric 1.x (legacy) focused on fabfiles with decorators; Fabric 2.x+ (current, Python 3) uses the Invoke library for tasks, improving modularity, concurrency, and core logic separation.
Install via pip install fabric. Example fabfile: from fabric import task
@task
def deploy(c):
c.run('git pull')
Run: fab deploy. Ideal for DevOps scripting without agent requirements. Supports gateways, key auth, and prompts. (172 words)
CAVEATS
CLI is fab, not always fabric; requires Python 3+ and pip install fabric. No built-in manpage; tasks must be defined in fabfile.py. Fabric 1.x deprecated.
BASIC EXAMPLE
fab -H user@host deploy
Executes deploy task on remote host.
INSTALLATION
pip install fabric
Requires paramiko for SSH.
HISTORY
Created 2008 by Jeff Forcier as Fabric 1.x for SSH fabfiles. Rewritten 2016 as Fabric 2.0 by Jeff Geerling/bitprophet, integrating Invoke for better parallelism and Python 3. Fabric 3.x (2023+) enhances API stability and concurrency.


