Changes

Jump to: navigation, search

OPS435 Python Lab 8

1,349 bytes added, 09:28, 21 January 2020
no edit summary
<font color= THIS LAB IS 'red'>'''** DO NOT READY YET!!! = PLEASE WAIT UNTIL THE LAB IS PUBLISHED. IT IS CURRENTLY UNDER CONSTRUCTIONUSE - TO BE UPDATED FOR CENTOS 8.0 **'''</font>
= LAB OBJECTIVES =
= INVESTIGATION 1: Extra VM Setup =
In order to experience Fabric's features in a realistic way, we're going to set up several virtual machines. To begin with they are all going to have the same configuration. Please make sure that each VM has direct network connect with other VMs you wish to control and configure.
== PART 1 - Set up your controller ==
<source lang="python">
run("iptables -I INPUT -p tcp --dport 80 -j ACCEPT")
run("iptables-save > /etc/sysconfig/iptables")
</source>
... move your iptables rules setup here ...
</source>
 
Test your new setupFirewall function on worker1, and make sure it opens access to Apache but does not create duplicate rules every time it's run.
 
= INVESTIGATION 3: Multiplying your work =
 
After completing all the previous parts of the lab - you should have a working fabfile.py with two working functions: setupFirewall() and setupWebServer().
 
You were asked to test them on worker1. Now let's run these two functions on all your workers at the same time. The command is almost the same, except for the list of IP addresses:
 
<source lang="bash">fab --fabfile=fabfile.py -H 192.168.56.11,192.168.56.12,192.168.56.13,192.168.56.14,192.168.56.15 setupWebServer</source>
 
Again - your IP addresses will be different but the command will be the same.
 
You can also reconfigure the firewall on all the workers at the same time, using a command like this on your controller:
 
<source lang="bash">fab --fabfile=fabfile.py -H 192.168.56.11,192.168.56.12,192.168.56.13,192.168.56.14,192.168.56.15 setupFirewall</source>
 
And imagine that you might have 10, 50, 100 servers to do this on - could you do it without the automation?
= LAB 8 SIGN-OFF (SHOW INSTRUCTOR) =
:'''Have Ready to Show Your Instructor:'''
* Complete all the parts of the lab and show your fabfile.py as well as Apache working on all five virtual machines.
= LAB REVIEW =
 
[[Category:OPS435-Python]]
1,760
edits

Navigation menu