Table of Contents

Top#How to use FastHandle

How to use Fabric in Python



FastHandle use Fabric. So you must learn Fabric.



About Fabric

Fabric is a Python library and command-line tool for streamlining the use of SSH for application deployment or systems administration tasks.

Fabric Python (2.5-2.7)
http://www.fabfile.org/
fabric2 Python (2.7, 3.4+)
http://www.fabfile.org/
fabric3 Python (2.7, 3.4+) .
Fabric3 is a fork of Fabric to provide compatability with Python 3.4+. The port still works with Python 2.7.
https://pypi.org/project/Fabric3/
https://github.com/mathiasertl/fabric/


fab Command Options

Fabric use fab command.

$ fab -h
Usage: fab [options] <command>[:arg1,arg2=val2,host=foo,hosts='h1;h2',...] ...

Options:
  -h, --help            show this help message and exit


  -H HOSTS, --hosts=HOSTS
                        comma-separated list of hosts to operate on
  -w, --warn-only       warn, instead of abort, when commands fail


  -u USER, --user=USER  username to use when connecting to remote hosts
  -p PASSWORD, --password=PASSWORD
                        password for use with authentication and/or sudo
  -i PATH               path to SSH private key file. May be repeated.
  -I, --initial-password-prompt
                        Force password prompt up-front


  -P, --parallel        default to parallel execution method
  -z INT, --pool-size=INT
                        number of concurrent processes to use in parallel mode


Example fab command

$ fab -H test-server-1 -u user01 -p XXXX -- hostname
$ fab -H test-server-1,test-server-2 -u user01 -p XXXX -- hostname

$ PASS=XXXX
$ fab -H test-server-1 -u user01 -p $PASS -- hostname

~]$ fab -H  xx.xx.xx.xx -u USER01 -- hostname
[xx.xx.xx.xx] Executing task '<remainder>'
[xx.xx.xx.xx] run: hostname
[xx.xx.xx.xx] Login password for 'USER01':
[xx.xx.xx.xx] out: test-server-01
[xx.xx.xx.xx] out:


operation





Top#How to use FastHandle