Changes

Jump to: navigation, search

OPS435 Python3 Lab 8

14 bytes added, 14:24, 10 November 2019
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.
1,760
edits

Navigation menu