{% set k = keepalive %} global_defs { script_user root enable_script_security } vrrp_script check_maxscale { script "/usr/bin/pgrep maxscale" interval 4 timeout 4 rise 3 fall 3 } {% for vip in k.vips %} vrrp_instance {{ vip.name }} { interface {{ k.interface }} state BACKUP priority {{ k.priorities.master if vip.host == inventory_hostname_short else k.priorities.backup }} virtual_router_id {{ vip.vrid }} advert_int 1 accept unicast_src_ip {{ ansible_host }} unicast_peer { {% for peer in k.peers if peer.host != inventory_hostname %} {{ peer.ip }} {% endfor %} } virtual_ipaddress { {{ vip.vip }} } track_script { check_maxscale } } {% endfor %}