Use defined keepalived track_scripts

We define script inside keepalived_scripts, however have to override
keepalived_instances once define another set of scripts, as track_scripts
are hardcoded.
We change this by dynamically set track_scripts with  what we have in
keepalived_scripts keys.

Change-Id: I763ebba501f3e71009b6d3b2c011e7f069e47f5d
This commit is contained in:
Dmitriy Rabotyagov
2020-04-22 16:36:32 +03:00
committed by Dmitriy Rabotyagov (noonedeadpunk)
parent f9fd3c3ad6
commit b7c6b42d5b

View File

@@ -62,17 +62,13 @@ keepalived_instances:
authentication_password: "{{ haproxy_keepalived_authentication_password }}"
vips:
- "{{ haproxy_keepalived_external_vip_cidr | default('169.254.1.1/24') }} dev {{ haproxy_keepalived_external_interface | default(management_bridge) }}"
track_scripts:
- haproxy_check_script
- pingable_check_script
track_scripts: "{{ keepalived_scripts.keys() }}"
internal:
interface: "{{ haproxy_keepalived_internal_interface | default(management_bridge) }}"
state: "{{ (groups['haproxy'].index(inventory_hostname) == 0) | ternary('MASTER', 'BACKUP') }}"
virtual_router_id: "{{ haproxy_keepalived_internal_virtual_router_id | default ('11') }}"
priority: "{{ (groups['haproxy']|length-groups['haproxy'].index(inventory_hostname))*50 }}"
authentication_password: "{{ haproxy_keepalived_authentication_password }}"
track_scripts:
- haproxy_check_script
- pingable_check_script
track_scripts: "{{ keepalived_scripts.keys() }}"
vips:
- "{{ haproxy_keepalived_internal_vip_cidr | default('169.254.2.1/24') }} dev {{ haproxy_keepalived_internal_interface | default(management_bridge) }}"