--- haproxy_docker_container: True haproxy_ha_with_keepalived: '{{ docker_swarm_haproxy_keepalive_installation }}' keepalived_install: '{{ docker_swarm_haproxy_keepalive_installation }}' keepalived_vrouter_id: '{{ docker_swarm_keepalived_vrouter_id }}' keepalived_use_unicast: False keepalived_floating_ip1: '{{ docker_swarm_keepalived_floating_ip }}' keepalived_instance1_name: '{{ docker_swarm_keepalived_instance_name }}' keepalived_nagios_check: False keepalived_service_to_check: 'haproxy' keepalived_script1_check: "/usr/bin/docker container ls --filter name=haproxy | /bin/grep haproxy" docker_swarm_haproxy_constraints: '{{ haproxy_docker_swarm_haproxy_constraints }}' # The allowed_networks parameter is optional docker_swarm_haproxy_additional_services: '{{ haproxy_docker_swarm_additional_services }}' docker_haproxy_service_name: 'haproxy_haproxy' docker_swarm_haproxy_networks: '{{ haproxy_docker_swarm_networks }}' docker_swarm_haproxy_additional_networks: '{{ haproxy_docker_swarm_additional_networks }}' keepalived_scripts: - name: '{{ keepalived_script1_name }}' script: '{{ keepalived_check_script }}' # In seconds interval: 2 # Priority increment weight: -20 fall: 2 raise: 2 keepalived_instances: - name: '{{ keepalived_instance1_name }}' interface: '{{ ansible_default_ipv4.interface }}' state: BACKUP vrouter_id: '{{ keepalived_vrouter_id }}' notify: '{{ keepalived_notify_script }}' priority: '{{ keepalived_inst_priority }}' nopreempt: True v_addr: - '{{ keepalived_floating_ip1 }}' track_script: - '{{ keepalived_script1_name }}' authentication: PASS authpass: '{{ keepass_auth_pwd }}' keepalived_unicast_src_ip: '{{ ansible_default_ipv4.address }}' keepalived_unicast_peer_ip: '{{ keepalived_unicast_remote_peer }}' keepalived_notify_extra_params: | case $STATE in "MASTER") logger "This HAPROXY instance is now in MASTER state" ;; "BACKUP") logger "This HAPROXY instance is now in BACKUP state" ip addr del {{ keepalived_floating_ip1 }} dev {{ ansible_default_ipv4.interface }} ;; "FAULT") logger "This HAPROXY instance went into FAULT state" RETVAL=0 ;; *) logger "HAPROXY server is in an unknown state" RETVAL=1 ;; esac