Add option to set the check port

The option to set the checkport is needed when trying to balance traffic
to a service that uses a secondary port to verify service availability.
This is being implemented to support galera which should be using an
HTTP based check to verify sync status instead of a simple mysql login.
For reference this is what the folks at Percona are recommending [0].

[0] https://www.percona.com/doc/percona-xtradb-cluster/LATEST/howtos/virt_sandbox.html
Closes-Bug: #1665667

Change-Id: I81c924464aa4b19c2a62f37b5bf26c3c0453786a
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
(cherry picked from commit 0eb657614e)
This commit is contained in:
Kevin Carter 2017-11-16 18:00:58 -06:00 committed by Jesse Pretorius (odyssey4me)
parent 79151d4187
commit 44ba7a0e96
1 changed files with 7 additions and 2 deletions

View File

@ -6,6 +6,11 @@
{% else %}
{% set haproxy_backend_port = item.service.haproxy_backend_port %}
{% endif -%}
{% if item.service.haproxy_check_port is not defined %}
{% set haproxy_check_port = haproxy_backend_port %}
{% else %}
{% set haproxy_check_port = item.service.haproxy_check_port %}
{% endif -%}
{% set vip_binds = [external_lb_vip_address] -%}
{%- if internal_lb_vip_address not in vip_binds %}
@ -94,7 +99,7 @@ backend {{ item.service.haproxy_service_name }}-back
{% set _ = entry.append(hostvars[host_name]['ansible_ssh_host'] + ":" + haproxy_backend_port | string) %}
{% set _ = entry.append("check") %}
{% set _ = entry.append("port") %}
{% set _ = entry.append(haproxy_backend_port | string) %}
{% set _ = entry.append(haproxy_check_port | string) %}
{% set _ = entry.append("inter") %}
{% set _ = entry.append(haproxy_interval | string) %}
{% set _ = entry.append("rise") %}
@ -111,7 +116,7 @@ backend {{ item.service.haproxy_service_name }}-back
{% set _ = entry.append(hostvars[host_name]['ansible_ssh_host'] + ":" + haproxy_backend_port | string) %}
{% set _ = entry.append("check") %}
{% set _ = entry.append("port") %}
{% set _ = entry.append(haproxy_backend_port | string) %}
{% set _ = entry.append(haproxy_check_port | string) %}
{% set _ = entry.append("inter") %}
{% set _ = entry.append(haproxy_interval | string) %}
{% set _ = entry.append("rise") %}