What is Ansible Roles?

#Inventory file
vim ip.txt
#Pinging all the managed nodes to check connectivity
ansible all -m ping
#We create ansible roles before writing the playbooks ansible-galaxy init /etc/ansible/roles/apache          #For HTTPD

ansible-galaxy init /etc/ansible/roles/haproxy #For HAProxy

Task 15.1 Description

🔅Create an ansible role myapache to configure Httpd WebServer.

Task file for HTTPD role

Task 15.2 Description

🔅Create another ansible role myloadbalancer to configure HAProxy LB.

Task file for HAProxy

Task 15.3 Description

🔅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.

Ansible playbook to configure HTTPD and HAProxy

Connecting to the Loadbalancer IP using 8080 port to check if it’s working or not.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store