Add ability to have different backend port.

Add the possibility to have multiple backend services running on
differents ports.

Change-Id: I1748bfc15bdf879f78aa06c385af7b6c45bde7ff
This commit is contained in:
Marc Gariepy 2023-07-12 13:46:43 -04:00
parent 848e316ef5
commit 4513bc84ae
2 changed files with 9 additions and 2 deletions

View File

@ -0,0 +1,7 @@
---
features:
- HAProxy services that use backend nodes that are not
in the Ansible inventory can now have the ``backend_port``
specified in the list, along with ``name`` or ``ip_addr`` settings.
This allow to have the service bound to different port on different
backend servers.

View File

@ -134,10 +134,10 @@ backend {{ service.haproxy_service_name }}-back
{% set entry = [] %}
{% set _ = entry.append("server") %}
{% set _ = entry.append((host_name.name | default(host_name)) | string) %}
{% set _ = entry.append((host_name.ip_addr | default(ip_addr)) + ":" + haproxy_backend_port | string) %}
{% set _ = entry.append((host_name.ip_addr | default(ip_addr)) + ":" + (host_name.backend_port | default(haproxy_backend_port)) | string) %}
{% set _ = entry.append("check") %}
{% set _ = entry.append("port") %}
{% set _ = entry.append(haproxy_check_port | string) %}
{% set _ = entry.append(host_name.backend_port | default(haproxy_check_port) | string) %}
{% set _ = entry.append("inter") %}
{% set _ = entry.append(service.interval|default(haproxy_interval) | string) %}
{% set _ = entry.append("rise") %}