From 61fb3bf2abf51814891f17372ec79195299519a2 Mon Sep 17 00:00:00 2001 From: Bart Geesink Date: Thu, 29 Feb 2024 11:07:12 +0100 Subject: [PATCH] Haproxy: Allow a port number to be set for a server This overrides the default port set in haproxy_applications. Useful in migration scenarios --- roles/haproxy/templates/haproxy_backend.cfg.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/haproxy/templates/haproxy_backend.cfg.j2 b/roles/haproxy/templates/haproxy_backend.cfg.j2 index b82b1e005..973631e51 100644 --- a/roles/haproxy/templates/haproxy_backend.cfg.j2 +++ b/roles/haproxy/templates/haproxy_backend.cfg.j2 @@ -34,7 +34,7 @@ cookie HTTPSERVERID insert nocache indirect httponly secure maxidle {{ haproxy_cookie_max_idle }} {% for server in application.servers %} - server {{ server.label }} {{ server.ip }}:{{ application.port }} cookie {{ server.label }} check inter 8000 fall 5 rise 2 maxconn {{ application.maxconn | default('35') }} {% if application.sslbackend is defined%} ssl verify required verifyhost {{ application.backend_vhost_name }} ca-file {{ application.backend_ca_file }}{% endif %} weight 100 + server {{ server.label }} {{ server.ip }}:{% if server.port is defined %}{{ server.port }}{% else %}{{ application.port }}{% endif %} cookie {{ server.label }} check inter 8000 fall 5 rise 2 maxconn {{ application.maxconn | default('35') }} {% if application.sslbackend is defined%} ssl verify required verifyhost {{ application.backend_vhost_name }} ca-file {{ application.backend_ca_file }}{% endif %} weight 100 {% endfor %} @@ -60,7 +60,7 @@ cookie HTTPSERVERIDSTAGING insert nocache indirect httponly secure maxidle {{ haproxy_cookie_max_idle }} {% for server in application.stagingservers %} - server {{ server.label }} {{ server.ip }}:{{ application.port }} cookie {{ server.label }} check inter 8000 fall 5 rise 2 maxconn {{ application.maxconn | default('35') }} {% if application.sslbackend is defined%} ssl verify required verifyhost {{ application.backend_vhost_name }} ca-file {{ application.backend_ca_file }}{% endif %} weight 100 + server {{ server.label }} {{ server.ip }}:{% if server.port is defined %}{{ server.port }}{% else %}{{ application.port }}{% endif %} cookie {{ server.label }} check inter 8000 fall 5 rise 2 maxconn {{ application.maxconn | default('35') }} {% if application.sslbackend is defined%} ssl verify required verifyhost {{ application.backend_vhost_name }} ca-file {{ application.backend_ca_file }}{% endif %} weight 100 {% endfor %} {% endif %}