Ansible PlayBook to Configure HTTPD and HAProxy Using Ansible Roles

In this article we will:

  1. We will create an ansible role httpd to configure Httpd WebServer.

2. We will create another ansible role haproxy to configure HAProxy LoadBalancer.

3. We will combine both of these roles controlling web server versions and solving challenges for host IP’s addition dynamically over each Managed Node in HAProxy.cfg file.

Role for Configuring HTTPD

  • Create a Role
  • Task File
  • Var File
  • Handler File
  • Index.j2 file

Role for Configuring HAProxy

  • Create a Role
  • Task File
  • Var File
  • Handler File
  • HAProxy Configuration file

PlayBook For HTTP and HAProxy

Inventory File

Ansible Configuration File