Ansible playbooks in action
Let's suppose you are creating an Apache server that serves a custom website. It also connects with a MySQL backend. In short, we are setting up a Linux, Apache, MySQL, and PHP (LAMP) stack using Ansible.
The following directory contains all resources for the exercises in this section:
$ cd ~/modern-devops/ch7/lamp-stack
We have created the following custom index.php
page that tests the connection to the MySQL database and displays whether it can connect or not:
... <?php mysqli_connect('db', 'testuser', 'Password@1') or die('Could not connect the database : Username or password incorrect'); echo 'Database Connected successfully'; ?> ...
We create several Ansible playbooks according to the logical steps we follow with configuration management.
It is an excellent practice to update the packages and repositories at the start of every configuration. Therefore, we need to start our...