Add keepalived element

This element will be needed for HA deployments

Change-Id: Ice66cc490abaf54109c0678296055d111ef69f4c
This commit is contained in:
Jan Provaznik 2013-12-10 14:37:39 -05:00
parent 0a9ac8bfc7
commit 8380989be7
4 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,14 @@
Element to install keepalived
Configuration
-------------
keepalived:
keepalive_interface: eth0
- interface used for VRRP traffic
virtual_ips:
- you can define one or more virtual IPs including IPv6:
- ip: 192.0.2.254/24
interface: eth0
- ip: fe80::5cc1:afff:fe58:143b/64
interface: br-ctlplane

View File

@ -0,0 +1,9 @@
#!/bin/bash
set -eux
install-packages keepalived
if [ "$DIB_INIT_SYSTEM" == "systemd" ] ; then
systemctl enable keepalived.service
fi

View File

@ -0,0 +1,20 @@
vrrp_script chk_haproxy {
script "killall -0 haproxy"
interval 2
weight 2
}
vrrp_instance VI_1 {
interface {{keepalived.keepalive_interface}}
state MASTER
virtual_router_id 51
priority {{keepalived.priority}} # 101 on master, 100 on backup
virtual_ipaddress {
{{#virtual_ips}}
{{ip}} dev {{interface}}
{{/virtual_ips}}
}
track_script {
chk_haproxy
}
}

View File

@ -0,0 +1,4 @@
#!/bin/bash
set -eux
service keepalived restart