hifis.haproxy

<!--
SPDX-FileCopyrightText: 2020 Helmholtz Centre for Environmental Research (UFZ)
SPDX-FileCopyrightText: 2020 Helmholtz-Zentrum Dresden-Rossendorf (HZDR)

SPDX-License-Identifier: Apache-2.0
-->

# HAProxy Role

:warning: **This project is archived!** :warning:

This role has been moved to our `hifis.toolkit` collection:

- <https://github.com/hifis-net/ansible-collection-toolkit>
- <https://galaxy.ansible.com/ui/repo/published/hifis/toolkit/>

[![CI Status](https://github.com/hifis-net/ansible-role-haproxy/actions/workflows/ci.yml/badge.svg)](https://github.com/hifis-net/ansible-role-haproxy/actions/workflows/ci.yml)
[![Ansible Role: hifis.haproxy](https://img.shields.io/badge/role-hifis.haproxy-blue)](https://galaxy.ansible.com/ui/standalone/roles/hifis/haproxy/)
[![Ansible Role Downloads](https://img.shields.io/ansible/role/d/hifis/haproxy)](https://galaxy.ansible.com/ui/standalone/roles/hifis/haproxy/)
[![Apache-2.0 Licensed](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/hifis-net/ansible-role-haproxy/blob/main/LICENSES/Apache-2.0.txt)
[![Latest release](https://img.shields.io/github/v/release/hifis-net/ansible-role-haproxy)](https://github.com/hifis-net/ansible-role-haproxy/releases)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.6997437.svg)](https://doi.org/10.5281/zenodo.6997437)

This role sets up HAProxy to function as a load balancer, helping with high availability and scalability.

Currently supported platforms:

- Ubuntu 22.04 LTS
- Ubuntu 20.04 LTS

This role is tested with the two latest LTS versions of HAProxy, supporting:
- `2.6`
- `2.4`

Other versions may work but are not automatically tested.

## Requirements

None.

## Role Variables

### Required variables that are not set by default

#### Backend GitLab IP addresses

Provide a list of backend servers with their names and IP addresses (Port is optional, defaults to `80`):

```yaml
haproxy_backends:
  - backend_name: 'backend_server_1'
    backend_ip: '192.168.33.10'
    backend_port: '80'

Frontend floating IP address

Set the floating IP address for the frontend:

haproxy_frontend_ip: '192.168.33.100'

Required variables that have default values but should be changed

Number of processors for HAProxy

Sets the number of processors used by HAProxy:

haproxy_nbproc: '1'

Number of threads for HAProxy

Sets the number of threads used by HAProxy:

haproxy_nbthread: '2'

HAProxy CPU Map for Multithreading

Assign threads to CPU cores:

haproxy_cpumap: 'auto:1/1-2 0-1'

Enable/disable stats

Variable to turn stats on or off:

haproxy_stats_enable: 'enable'

Stats admin username

Variable for the stats admin username:

haproxy_stats_admin_user: 'admin'

Stats admin user password

Variable for the stats admin user password:

haproxy_stats_admin_user_password: 'changeme'

All other default variables

Path to HAProxy executable

Point to the HAProxy executable location:

haproxy_executable_path: '/usr/sbin/haproxy'

HAProxy PPA version

Set a specific PPA version:

haproxy_ppa_version: 'ppa:vbernat/haproxy-2.6'

HAProxy version

Specify the HAProxy version:

haproxy_version: '2.6.*'

HAProxy user and group

Set HAProxy system user and group:

haproxy_user: 'haproxy'
haproxy_group: 'haproxy'

HAProxy dependencies

List dependencies to install for HAProxy:

haproxy_dependencies:
  - 'software-properties-common'

HAProxy binary name

Set the HAProxy binary name:

haproxy_name: 'haproxy'

HAProxy configuration template

Provide the path to the HAProxy configuration template:

haproxy_config_template: 'haproxy.cfg.j2'

HAProxy configuration directory and file paths

Set the paths to the configuration directory and file:

haproxy_conf_dir: '/etc/haproxy/'
haproxy_conf_file_path: "/etc/haproxy/haproxy.cfg"

HAProxy logging configuration

Set the logging socket path and log level:

haproxy_log_socket: '/dev/log'
haproxy_log_level: 'info' # Options: emerg, alert, crit, err, warning, notice, info, debug.

HAProxy SSL settings

Settings for SSL certificates, including path for self-signed certificate creation:

haproxy_create_self_signed_cert: true
haproxy_ssl_certificate_dir: '/etc/haproxy/ssl'
haproxy_ssl_certificate_key_file: "/etc/haproxy/ssl/haproxy.key"
haproxy_ssl_certificate_crt_file: "/etc/haproxy/ssl/haproxy.crt"
# Additional SSL configuration can be added as needed

Example playbook

- hosts: loadbalancers
  roles:
    - role: hifis.haproxy
      vars:
        haproxy_frontend_ip: '192.168.33.100'
        haproxy_backends:
          - backend_name: 'backend_server_1'
            backend_ip: '192.168.33.10'
            backend_port: 80

License

Apache-2.0

Author Information

HIFIS Software Team

Contributors

Thanks to the following contributors for their help with this project:

```

Informazioni sul progetto

Install and configure HAProxy to be used for load-balancing in a high availability and scalability context.

Installa
ansible-galaxy install hifis.haproxy
Licenza
other
Download
25.9k
Proprietario
Helmholtz Digital Services for Science — Collaboration made easy.