Starting from:

$29

CS312 : Homework 7


Follow the instructions below to create an Ansible controller that can spin up 4 web servers using 4
blank-slate Alpine VMs. While this assignment doesn’t completely reflect a production usage of Ansible,
you will gain skills in using Ansible and realize some of the potential that configuration management has
to offer.
To get started with this homework, follow these instructions:
Setup and Study Tasks
1. Start up a pfSense router, a CentOS CLI VM, and four separate Alpine VMs, all on VirtualBox.
Make sure to check the box to reinitialize the MAC addresses of each of the Alpine VMs
when importing the appliances.
2. For the CentOS and Alpine VMs, make sure that the network setting in VirtualBox is set to
Internal Network, “CS312LAN”. This allows communication between the CentOS VM you will
be using for control and the Alpine VMs that will be configured via Ansible. The pfSense
router VM should have its first network interface set to “NAT”, and the second set to
Internal Network, “CS312LAN”.
3. Install Ansible on your controller VM, the CentOS box. You can do this using yum as follows:
yum install ansible
4. Write an Ansible playbook that can be run on your CentOS controller VM to provision each
of the four Alpine VMs as web servers. The basic “index.html” you deploy in this web server
image must contain the Ansible variable “template_run_date”.
The Alpine web server VMs should be accessible to any device on the LAN (CS312LAN).
5. Finally, you'll provide a bash shell script that the TA will run on the CentOS controller VM.
This shell script should do the following on this VM:
a. Generate an SSH key that will be used by Ansible when it pushes commands from the
playbook. Don’t use usernames & passwords to authenticate, use SSH instead; see note
below for exception.
b. Copy the SSH key to each of the Alpine VMs prior to running Ansible (scp and sshcopy-id are useful here, though you will have to initially type in the passwords for the
Alpine VMs).
c. Run the Ansible playbook on the CentOS VM.
d. Return the contents of “index.html” from each of the webservers now configured by
Ansible (hint: use curl).
What to Turn In and How
Submit a .ZIP file to the Canvas Homework 7 assignment that contains the following:
1. A text file that contains:
a. Your name, and the name of any partners you worked with (you may work in groups up
to size 4 for this assignment).
b. The names of your shell script and Ansible playbook.
c. Complete instructions on how to prepare and then run your Ansible playbook and shell
script, and what the expected output should be. Note that the TAs will use our reference
pfSense, CentOS, and Alpine VMs. Changes to these reference VMs are allowed for your
solution, but if you do make changes, you MUST detail each change in your instructions
so the TAs can make the same changes to their VMs and follow along (do NOT submit
VMs in any form). Test the complete process you want the TAs to follow before
submitting: make sure it works!
2. Any additional instructions or comments you feel are needed.
3. Your Ansible playbook, as described above.
4. A shell script that gets the data from the Alpine VMs, as described above.
5. Other files as necessary, e.g. the index.html file to be copied to the Ansible VMs.
Grading
There are 100 points possible in this assignment. They are awarded if your shell script and instructions
get the content from the 4 web servers, provided that the webservers have been provisioned by Ansible
running on the CentOS controller VM, as described above. The TAs may subtract up to 20 points at their
individual discretion for your submission not perfectly following directions, if the output is otherwise
correct.
If your submission does not return the webserver output as described, the TAs shall only assign up to 20
points partial credit total, at their individual discretion.

More products