Ansible Role -Apache HTTPD Server and HAProxy Server

Vanshita Mittal
3 min readDec 31, 2020

🔰 Ansible Role :

Roles let you automatically load related vars_files, tasks, handlers, and other Ansible artifacts based on a known file structure. Once you group your content in roles, you can easily reuse them and share them with other users.

ARTH — Task 15

🔰 Task Description :

🔅Create an ansible role myapache to configure Httpd WebServer.

🔅Create another ansible role loadbalancer to configure HAProxy LB.

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

🔰 STEPS :

  1. Setup the controller node and two managed node ; one for loadbalancer and another for webserver .

also setup the roles-path in ansible config file.

2. Create a role in roles path , for apache webserver configuration .

tasks directory contains the main tasks to be written in the role to serve a specific purpose and configure the Target Nodes.

3. Create a role in roles path for loadbalancer setup.

4. Now, create a playbook to run the whole code using ansible roles.

Run the playbook .

5. Now , to check -

Loadbalancer Managed node :

Webserver Managed node :

To check , webpage ->

✨✨Task is successfully completed !!

Thank You !

--

--