HAProxy TCP/HTTP Load Balancer

Document Control

TODO:

  • Overall structure.
  • Initial draft complete
  • Testing
  • Ready

Ansible Role Ansible Quality Score Build Status GitHub issues GitHub last commit

User Story: HAProxy

As a: UNIX and Linux system administrator

I want to: install HAProxy and configure it

So that: I can setup load balancing.

Using the role

Using the role in a playbook
---
- name: Install haproxy
  hosts: all

  tasks:
    - name: haproxy is configured
      import_role:
        name: devopstoolbox.haproxy
      vars:
        # defaults file for haproxy

        # Service
        haproxy_enable_service: true
        haproxy_copy_templates: true
        haproxy_firewall_configure: true
        haproxy_firewall_rules:
          - service: http

        # Frontend
        haproxy_frontend_port: 80

        # Backend
        haproxy_backend_name: app
        haproxy_backend_port: 80
        haproxy_backend_servers:
          - name: web01
            address: 192.168.0.1
          - name: web02
            address: 192.168.0.2
      tags: haproxy
# Install the role
ansible-galaxy install devopstoolbox.haproxy

# Run the playbook
ansible-playbook haproxy-playbook.yml

Last update: 2020-02-09