global_defs {
   router_id LVS_DEVEL
}

vrrp_script haproxy_check {
   script "killall -0 haproxy"
   interval 2
   weight 2 
}

vrrp_instance OCP_EXT {
   interface {{ external_interface }}

   virtual_router_id 51

   priority {% if groups.haproxy_group.index(inventory_hostname) == 0 %} {{ keepalived_priority_start }}{% else %} {{  keepalived_priority_start - 2 }}{% endif %}

   state {% if groups.haproxy_group.index(inventory_hostname) == 0 %} {{ "MASTER" }}{% else %} {{ "BACKUP" }}{% endif %}

   virtual_ipaddress {
       {{ openshift_master_cluster_public_ip }}  dev {{ external_interface }}

   }
   track_script {
       haproxy_check
   }
   authentication {
      auth_type PASS
      auth_pass {{ keepalived_pass.stdout }}
   }
}
