aboutsummaryrefslogtreecommitdiff
path: root/docker/common/keepalived/start.sh
diff options
context:
space:
mode:
authorSam Yaple <sam@yaple.net>2015-07-24 14:59:25 +0000
committerSam Yaple <sam@yaple.net>2015-07-30 19:08:22 +0000
commitab9f652113243c38bef59b907e6729ea5d17f9e0 (patch)
tree67b3224f759763676172a39dbe53352d2df6e827 /docker/common/keepalived/start.sh
parent731d5205cbed74028bda0883a5432afc476605b6 (diff)
downloadkolla-ab9f652113243c38bef59b907e6729ea5d17f9e0.tar.gz
kolla-ab9f652113243c38bef59b907e6729ea5d17f9e0.zip
Add keepalived to ansible
Adds the needed ansible bits to support keepalived Closes-Bug: #1479934 Change-Id: Iace29b23a0e923b1f5dc9a4f5bc0f88afce3ae62 Partially-Implements: blueprint ansible-service
Diffstat (limited to 'docker/common/keepalived/start.sh')
-rwxr-xr-xdocker/common/keepalived/start.sh34
1 files changed, 8 insertions, 26 deletions
diff --git a/docker/common/keepalived/start.sh b/docker/common/keepalived/start.sh
index 3d182f635..64f47e295 100755
--- a/docker/common/keepalived/start.sh
+++ b/docker/common/keepalived/start.sh
@@ -1,31 +1,13 @@
#!/bin/bash
+set -o errexit
-. /opt/kolla/kolla-common.sh
+CMD="/usr/sbin/keepalived"
+ARGS="-nld -p /run/keepalived.pid"
-check_required_vars KEEPALIVED_HOST_PRIORITIES \
- PUBLIC_INTERFACE \
- PUBLIC_IP
+# Loading common functions.
+source /opt/kolla/kolla-common.sh
-MY_HOSTNAME=`hostname`
+# Config-internal script exec out of this function, it does not return here.
+set_configs
-# here we unpack KEEPALIVED_HOST_PRIORITIES hostname:priority pairs and match
-# them with current hostname, if it's there
-for i in ${KEEPALIVED_HOST_PRIORITIES//,/ }; do
- HOST_PRIORITY=(${i//:/ })
- if [ "$MY_HOSTNAME" == "${HOST_PRIORITY[0]}" ]; then
- KEEPALIVED_PRIORITY=${HOST_PRIORITY[1]}
- fi
-done
-
-if [ -z "$KEEPALIVED_PRIORITY" ]; then
- echo "ERROR: missing hostname in KEEPALIVED_HOST_PRIORITIES: $MY_HOSTNAME" >&2
- exit 1
-fi
-
-sed -i '
- s|@PUBLIC_INTERFACE@|'$PUBLIC_INTERFACE'|g
- s|@PUBLIC_IP@|'$PUBLIC_IP'|g
- s|@KEEPALIVED_PRIORITY@|'$KEEPALIVED_PRIORITY'|g
-' /etc/keepalived/keepalived.conf
-
-exec /usr/sbin/keepalived -nld -p /run/keepalived.pid
+exec $CMD $ARGS