Ansible Role for configuring HAProxy and HTTPD webserver

Tharakramdasari
2 min readMay 7, 2021

--

Hey enthusiastic learners ,hope you all are doing great. Back with another technical article. In this article gonna explain about how to install and configure HAProxy,PHP and httpd webserver

HAProxy is free, open source software that provides a high availability load balancer and proxy server for TCP and HTTP-based applications that spreads requests across multiple servers.

Apache HTTPD is one of the most used web servers on the Internet. Apache HTTP Server is a free software/open source web server for Unix-like systems and other operating systems.

Installing and configuring manually takes time and can cause more trouble so instead of doing manually. With the help of Ansible Roles we are gonna install and configure HAProxy and httpd webser

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. The breaking of playbook allows you to logically break the playbook into reusable components

We need to update all ip addresses in ansible inventory file. So here is our ansible inventory file

Let’s check for connectivity of nodes from ansible node by pinging to it’s ip address

Now I am gonna create roles for HAProxy and httpd webserver

Syntax for creating Ansible Roles

ansible-galaxy init <role-name>

After creating ansible roles write required tasks in respected folders

Here is my GitHub link — https://github.com/THARAK-RAM1/ansible-role-for-haproxy-and-webserver

Here is my final file for running playbook

- hosts: webserver
roles:
- role: "webserver"

- hosts: haproxy
roles:
:
- role: "haproxy"

Thank you guys for reading…..

--

--

Tharakramdasari
Tharakramdasari

Written by Tharakramdasari

CSE Student at IIIT ONGOLE Learner at ARTH School of Technologies AWS || Docker || Ansible || Kubernetes CKA & CKAD || Hadoop || GCP || Machine Learning || Git

No responses yet