Week 13 Assignment
This assignment will hone your system automation skills with ansible and have you utilize roles.
Tasks
You will use ansible to automatically deploy the pokemon application found here. Don’t forget that you need to install apache2,libapache2-mod-php, php, php-mysql on the web machine.
On the mysql machine, you will install mysql-server
and python-mysqldb
.
I will be looking to see that you are utilizing variables, roles, and other concepts that we have learned in class. You will at a minimum have 2 roles: one for mysql, one for apache. (You should have separate machines for these services as well).
If you get errors like
unable to find /root/.my.cnf
, you should add the followinglogin_unix_socket: /var/run/mysqld/mysqld.sock
to any mysql modules you are using, like:- name: create poke db mysql_db: login_unix_socket: /var/run/mysqld/mysqld.sock name: pokemondb state: present
You could choose to automatedly visit the install.php page, or do so manually. (i.e. via a curl command)
You should show me that your playbook runs and that the pokemon app will load for you in a web browser.
HINTS
Here is an example of how a playbook can be used to send in variables to a role:
---
- hosts: php
gather_facts: no
roles:
- { role: ../roles/nfs, AUTOFS: "yes" }
- { role: ../roles/hostname, HOSTNAMEVAR: php }
Submission
Pass off in class.
Last Updated 02/07/2025