From 7d56ede387fe40bdc850b44b5cd7f9dacc990f61 Mon Sep 17 00:00:00 2001 From: Ben Morrow Date: Sun, 4 Aug 2013 22:38:22 -0700 Subject: [PATCH] Add Fabric basic tutorial --- fabric/HOWTOFABRIC.txt | 55 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 fabric/HOWTOFABRIC.txt diff --git a/fabric/HOWTOFABRIC.txt b/fabric/HOWTOFABRIC.txt new file mode 100644 index 0000000..9d79c36 --- /dev/null +++ b/fabric/HOWTOFABRIC.txt @@ -0,0 +1,55 @@ +Using fabric: + +Install: +(http://docs.fabfile.org/en/1.7/installation.html) + +pip install fabric + +Tutorial: + +http://docs.fabfile.org/en/1.4.0/index.html#tutorial + +Usage: + +write a python file called fabfile.py (or add to the current one) + +annotate tasks with @task + +e.g: + +from fabric.api import run,env,task,sudo,cd + +@task +def sayHelloAll(): + print "Hello local" + run("echo Hello Remote") + +then from the command line: + +#shows all commands + +fab list + +# run a command + +fab sayHello + +# run command on specific host + +fab sayHello:host=192.168.1.29 + +# run a command on a specific host with a specific user + +fab -u someUser startBoard:host=192.168.1.29 + +Run multiple: + +fab task1 task2 + +Run arbitrary remote command: + + fab [options] -- [shell command] + + + + -- 2.34.1