1,760
edits
Changes
→PART 1: Simplest example
fab -l
</source>
: you should get a list of tasks stored in your fabfile.py:<source lang="bash">
[rchan@centos7 lab8]$ fab -f fabfile.py -l
Available commands:
getHostname
</source>
: To perform the task of getHostname on the worker machine 192.168.122.169, we run it on the controller machine like this:<source lang="bash">
[rchan@centos7 lab8]$ fab -f fabfile.py -H 192.168.122.169. getHostname
[192.168.122.169] Executing task 'getHostname'
Done.
Disconnecting from 192.168.122.169... done.
</source>
:All this has done is get the hostname of the worker and print it (on the controller).
:In the command above we're using the fab program to import the file fabfile.py and execute the getHostname function on the worker 192.168.122.169. Note that the IP address of your first worker will likely be different.