2020-09-24 16:01:51 +02:00
|
|
|
---
|
2020-09-30 17:19:30 +02:00
|
|
|
haproxy_docker_container: True
|
|
|
|
haproxy_ha_with_keepalived: True
|
2020-09-30 19:02:46 +02:00
|
|
|
|
|
|
|
keepalived_install: True
|
|
|
|
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"
|
|
|
|
|
|
|
|
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 }}'
|
2020-10-01 19:11:50 +02:00
|
|
|
|
|
|
|
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
|