CS312 :: Homework 6 Follow the instructions below to create an Ansible controller that can spin up web servers using some blank-slate Alpine VMs. While this assignment does not completely reflect a production usage of Ansible, we 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 VM, an Alpine VM as a controller, and 2 separate Alpine VMs to be hosts controlled by the controller (in production we would likely use many more than 2 instances of an application of any size, but two will act as our proof of concept). Make sure to check the box to reinitialize the MAC addresses of each of the Alpine VMs when cloning or importing from appliances. Note: remember to run setup-alpine on the Alpine machines! 2. For the controller and hosts, make sure that the network setting in VirtualBox is set to Internal Network, “CS312LAN”. This allows communication between the controller and the hosts that will be configured via Ansible. The router should have its first network interface set to “NAT”, and the second set to Internal Network, “CS312LAN”. 3. Install Ansible on our controller. we can do this using apk as follows: apk add ansible 4. Write an Ansible playbook that can be run on your controller to provision each of the Alpine machines as web servers. The basic “index.html” we deploy in this web server image must contain the Ansible variable “template_run_date”. The Alpine web servers should be accessible to any device on the LAN (CS312LAN). 5. Finally, provide us with a bash shell script and a screenshot of it running on the controller. This shell script should do (and the screenshots should show) the following on this VM: a. Generate an SSH key that will be used by Ansible when it pushes commands from the playbook. Use SSH and public keys instead of usernames and passwords to authenticate; see note below for exception. b. Copy the SSH key to each of the host machines prior to running Ansible (scp and ssh- copy-id are useful here, though you will have to initially type in the passwords for the Alpine machines). c. Run the Ansible playbook on the controller. 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 file that contains: a. Your name, and the name of any partners we worked with (we may work in groups with up to 4 students for this assignment). (2.5 points) b. The names of your shell script and Ansible playbook. (2.5 points) c. Complete instructions (include your screenshots!) on how to prepare and then run the Ansible playbook and shell script, and what the expected output should be. Note that the learning assistants will use our own pfSense and Alpine machines. Changes to the machines are allowed for your solution, but if you do make changes, you MUST detail each change in the instructions (internal OS changes should be in a shell script) so the learning assistants can make the same changes to their VMs and follow along (do NOT submit machine images in any form). Test the complete process that will be submitted before submitting; make sure it works! (15 points) 2. Any additional instructions or comments as needed. 3. The Ansible playbook, as described above. (15 points) 4. A shell script that gets the data from the host machines, as described above. (10 points) 5. Other files as necessary, such as the index.html file to be copied to the host machines. (5 points) Grading There are 50 points possible in this assignment. They are awarded if the shell script and instructions get the content from the web server hosts, provided that the web server hosts have been provisioned by Ansible running on the controller, as described above. The learning assistants may subtract up to 15 points at their individual discretion for a submission where the directions are not clear enough for them to follow (screenshots are amazing for showing directions), if the output is otherwise correct. If the submission does not return the webserver output as described, the learning assistant may drop the full 15 points on the directions along with partial credit for the other components, at their individual discretion.