Merge branch 'newlayout' of https://github.com/sugarcubes/SugarCubes
[SugarCubes.git] / fabric / HOWTOFABRIC.txt
CommitLineData
7d56ede3
BM
1Using fabric:
2
3Install:
4(http://docs.fabfile.org/en/1.7/installation.html)
5
6pip install fabric
7
8Tutorial:
9
10http://docs.fabfile.org/en/1.4.0/index.html#tutorial
11
12Usage:
13
14write a python file called fabfile.py (or add to the current one)
15
16annotate tasks with @task
17
18e.g:
19
20from fabric.api import run,env,task,sudo,cd
21
22@task
23def sayHelloAll():
24 print "Hello local"
25 run("echo Hello Remote")
26
27then from the command line:
28
29#shows all commands
30
31fab list
32
33# run a command
34
35fab sayHello
36
37# run command on specific host
38
39fab sayHello:host=192.168.1.29
40
41# run a command on a specific host with a specific user
42
43fab -u someUser startBoard:host=192.168.1.29
44
45Run multiple:
46
47fab task1 task2
48
49Run arbitrary remote command:
50
51 fab [options] -- [shell command]
52
53
54
55