Configure Load Balancer & Web Server with Ansible Roles on AWS Cloud
✿ What is Ansible ?
Ansible is an open-source automation tool, or platform, used for IT tasks such as configuration management, application deployment, intraservice orchestration, and provisioning.
✿ What is Roles in Ansible ?
Ansible Roles provide a framework for fully independent, or interdependent collections of variables, tasks, files, templates, and modules. In Ansible, the role is the primary mechanism for breaking a playbook into multiple files. This simplifies writing complex playbooks, and it makes them easier to reuse.
🔰 So let’s begin….
♦️ Inventory File :
♦️ Ansible Configuration File :
🔅 Create an ansible role “webserver” to configure httpd WebServer.
ansible-galaxy role init webserver
🔅 Create another ansible role “mylb” to configure HAProxy LB.
ansible-galaxy role init mylb
♦️ Here, you can see two roles created :
ansible-galaxy role list
Now writing roles :
♦️ In webserver role,
a) In tasks ;
b) In vars ;
c) In template;
♦️ In mylb role,
a) In tasks ;
b) In vars ;
c) In templates ;
🔅 We need to combine both of these roles controlling webserver versions and solving challenge for host ip’s addition dynamically over each Managed Node in HAProxy.cfg file.