From 0586a6f19a809c0669e125303eaae0bfccf1b80f Mon Sep 17 00:00:00 2001 From: Nick M <4718+rkage@users.noreply.github.com> Date: Tue, 16 Feb 2021 04:20:42 -0500 Subject: [PATCH] fix keepalived config so proper master is identified (#110) Signed-off-by: Nick M <4718+rkage@users.noreply.github.com> --- ansible/roles/keepalived/templates/keepalived.conf.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ansible/roles/keepalived/templates/keepalived.conf.j2 b/ansible/roles/keepalived/templates/keepalived.conf.j2 index 167d6250..17f1fc0b 100644 --- a/ansible/roles/keepalived/templates/keepalived.conf.j2 +++ b/ansible/roles/keepalived/templates/keepalived.conf.j2 @@ -1,8 +1,8 @@ vrrp_instance VI_1 { - state {{ 'MASTER' if hostvars[groups['masters'][0]] else 'BACKUP' }} + state {{ 'MASTER' if inventory_hostname in groups['controlplane']|first else 'BACKUP' }} interface {{ keepalived_interface }} virtual_router_id 1 - priority {{ '150' if hostvars[groups['masters'][0]] else '100' }} + priority {{ '150' if inventory_hostname in groups['controlplane']|first else '100' }} advert_int 1 authentication { auth_type PASS