diff options
author | Viacheslav <v.gletenko@vyos.io> | 2021-12-27 13:54:54 +0000 |
---|---|---|
committer | Viacheslav <v.gletenko@vyos.io> | 2021-12-27 13:54:54 +0000 |
commit | da7248337aa09a95c58c253f99f0858bda780396 (patch) | |
tree | 9d73649e3318ad72968b42c748a29c910e37c372 | |
parent | acf90165456e87cff19f45053261667803255c8e (diff) | |
download | vyos-1x-da7248337aa09a95c58c253f99f0858bda780396.tar.gz vyos-1x-da7248337aa09a95c58c253f99f0858bda780396.zip |
keepalived: T4081: Fix health-checking when syn-group is used
If health-check scripts are used in vrrp group and vrrp group
is member of sync-group, then health-check scripts should be
part of the section "vrrp_sync_group". In another case the
health-scripts won't work anymore.
-rw-r--r-- | data/templates/vrrp/keepalived.conf.tmpl | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/data/templates/vrrp/keepalived.conf.tmpl b/data/templates/vrrp/keepalived.conf.tmpl index ea06a8b57..5e5674a6d 100644 --- a/data/templates/vrrp/keepalived.conf.tmpl +++ b/data/templates/vrrp/keepalived.conf.tmpl @@ -83,15 +83,24 @@ vrrp_instance {{ name }} { {% endif %} {% if sync_group is defined and sync_group is not none %} -{% for name, group_config in sync_group.items() if group_config.disable is not defined %} +{% for name, sync_group_config in sync_group.items() if sync_group_config.disable is not defined %} vrrp_sync_group {{ name }} { group { -{% if group_config.member is defined and group_config.member is not none %} -{% for member in group_config.member %} +{% if sync_group_config.member is defined and sync_group_config.member is not none %} +{% for member in sync_group_config.member %} {{ member }} {% endfor %} {% endif %} } + +{# Health-check scripts should be in section sync-group if member is part of the sync-group T4081 #} +{% for name, group_config in group.items() if group_config.disable is not defined %} +{% if group_config.health_check is defined and group_config.health_check.script is defined and group_config.health_check.script is not none and name in sync_group_config.member %} + track_script { + healthcheck_{{ name }} + } +{% endif %} +{% endfor %} {% if conntrack_sync_group is defined and conntrack_sync_group == name %} {% set vyos_helper = "/usr/libexec/vyos/vyos-vrrp-conntracksync.sh" %} notify_master "{{ vyos_helper }} master {{ name }}" |