Configuring HAProxy with Backend Server Using Ansible Role | Ansible Role |Task 15 | Arth

In this blog, I am going to show how can we configure proxy server & backend servers using Ansible Role. We will study & use the concepts of ansible role, how to create them or how to integrate them as the task proceed further.

Before going futher you should have some knowledge of following concepts:

  • Ansible Role
  • HAproxy
  • Ansible Playbook

Now let’s proceed this task…..

  • Firstly include the folder in the inventory file, where we will create the roles.
  • In this folder create roles using the giving command:-
# ansible-galaxy role init <role-name>

Here we created two different roles, one for proxy & one for webserver.
We can search system roles using the given command:

# ansible-galaxy role list
  • If we go inside the role folder’s we can see that their are different folder for variable, tasks, template, handlers etc.
  • We will write all the tasks in the “main.yml” file inside the “tasks” folder & variables in “main.yml” file inside “vars” folder.
  • Now create main playbook & include these roles
  • So let’s run this playbook.

So as you can see we have run the playbook successfully next let see the output.

Let check the Target Nodes…

  • Backend Node
  • Proxy Server

Now in last let’s check it running properly or not…

So finally we have completed the task…

We have completed the task.
If you have any issue doing it let me know.




Love podcasts or audiobooks? Learn on the go with our new app.

How to upgrade Golang version in Linux?

Microserver Market is projected to reach a value of over USD 71 billion by 2027 at a CAGR of…


Mistakes to Sidestep When Going For A Serverless Design

Understanding the security responsibilities of Azure VM Agents and Extensions #OMIGOD

ArcGIS Pro Python Clone Error, CondaVerification Error, Environments Clone Error solved!

How coding can protect you from society’s shackles

Voice Channels Now Have Built-in Text Channels

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
Gaurav Sharma

Gaurav Sharma


More from Medium

How to Install Terraform on Ubuntu / Rocky Linux & Fedora

Install terraform in rockylinux 8 and fedora 35

From Docker to Cloud with Gitlab CI/CD

3-tier / N-tier architecture on oracle cloud — (OCI)

Oracle N-tier applications implementation with high availability

How to use Azure KeyVault to set custom secrets in GitHub Action’s reusable flow