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