2019-04-04 10:54:41 +08:00
|
|
|
# {{ ansible_managed }}
|
|
|
|
! Configuration File for keepalived
|
|
|
|
|
|
|
|
global_defs {
|
|
|
|
router_id CEPH_RGW
|
|
|
|
}
|
|
|
|
|
|
|
|
vrrp_script check_haproxy {
|
|
|
|
script "killall -0 haproxy"
|
|
|
|
weight -20
|
|
|
|
interval 2
|
|
|
|
rise 2
|
|
|
|
fall 2
|
|
|
|
}
|
|
|
|
|
|
|
|
{% for instance in vrrp_instances %}
|
|
|
|
vrrp_instance {{ instance['name'] }} {
|
2019-12-04 02:51:22 +08:00
|
|
|
state {{ 'MASTER' if inventory_hostname == groups[rgwloadbalancer_group_name][0] else 'BACKUP' }}
|
|
|
|
priority {{ '100' if inventory_hostname == groups[rgwloadbalancer_group_name][0] else '90' }}
|
2019-04-04 10:54:41 +08:00
|
|
|
interface {{ virtual_ip_interface }}
|
|
|
|
virtual_router_id {{ 50 + loop.index }}
|
|
|
|
advert_int 1
|
|
|
|
authentication {
|
|
|
|
auth_type PASS
|
|
|
|
auth_pass 1234
|
|
|
|
}
|
|
|
|
virtual_ipaddress {
|
|
|
|
{{ instance['vip'] }}/{{ virtual_ip_netmask }} dev {{ virtual_ip_interface }}
|
|
|
|
}
|
|
|
|
track_script {
|
|
|
|
check_haproxy
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
{% endfor %}
|