diff --git a/roles/keepalived/defaults/main.yml b/roles/keepalived/defaults/main.yml index 4aeec8c..52c186a 100644 --- a/roles/keepalived/defaults/main.yml +++ b/roles/keepalived/defaults/main.yml @@ -4,5 +4,6 @@ keepalived__virtual_routes: {} keepalived__notify_master: [] keepalived__notify_backup: [] keepalived__notify_fault: [] +keepalived__main: false keepalived__max_auto_priority: -1 ... diff --git a/roles/keepalived/templates/keepalived.conf.j2 b/roles/keepalived/templates/keepalived.conf.j2 index dabd0e2..4df9973 100644 --- a/roles/keepalived/templates/keepalived.conf.j2 +++ b/roles/keepalived/templates/keepalived.conf.j2 @@ -44,7 +44,7 @@ vrrp_instance instance_v4 { virtual_router_id {{ keepalived__virtual_router_id | int }} interface {{ keepalived__interface }} state BACKUP - priority 250 + priority {{ keepalived__main | ternary(250, 150) }} nopreempt advert_int 1 accept @@ -79,7 +79,7 @@ vrrp_instance instance_v6 { virtual_router_id {{ keepalived__virtual_router_id | int }} interface {{ keepalived__interface }} state BACKUP - priority 250 + priority {{ keepalived__main | ternary(250, 150) }} nopreempt advert_int 1 accept