Learning how to use Ansible Automation to automate web servers and control traffic
We will set up a multi-task playbook that allows Apache httpd to be installed on the server rhel1 and NGINX to be installed on rhel2. After that, we will install HAProxy and set the two servers to roundrobin
load balance, all through the use of Ansible Automation.
Let’s start with the inventory, which will include the httpd web server, NGINX web server, and the HAProxy server, as shown in the following screenshot:
Figure 8.24 – Ansible Automation inventory file
Next, we will write out the playbook and files needed to make this work successfully. To do that, first, we will write out the beginning part of the playbook for the first server shown as follows:
--- - name: Install and configure Apache httpd hosts: rhel1.example.com become: true become_method: sudo tasks: - name: Install...