Add Router ID with environment KEEPALIVED_ROUTER_ID

This commit is contained in:
sinamoghaddas 2018-05-12 21:13:11 +04:30
parent 698f240b76
commit ec60acff4e
4 changed files with 5 additions and 2 deletions

View File

@ -1,5 +1,5 @@
NAME = osixia/keepalived
VERSION = 1.4.2
VERSION = 1.4.3
.PHONY: build build-nocache test tag-latest push push-latest release git-tag-version

View File

@ -16,3 +16,5 @@ KEEPALIVED_VIRTUAL_IPS:
- 192.168.1.232
KEEPALIVED_NOTIFY: /container/service/keepalived/assets/notify.sh
KEEPALIVED_ROUTER_ID: 51

View File

@ -10,7 +10,7 @@ vrrp_instance VI_1 {
}
state BACKUP
virtual_router_id 51
virtual_router_id {{ KEEPALIVED_ROUTER_ID }}
priority {{ KEEPALIVED_PRIORITY }}
nopreempt

View File

@ -11,6 +11,7 @@ if [ ! -e "$FIRST_START_DONE" ]; then
#
# bootstrap config
#
sed -i "s|{{ KEEPALIVED_ROUTER_ID }}|$KEEPALIVED_ROUTER_ID|g" ${CONTAINER_SERVICE_DIR}/keepalived/assets/keepalived.conf
sed -i "s|{{ KEEPALIVED_INTERFACE }}|$KEEPALIVED_INTERFACE|g" ${CONTAINER_SERVICE_DIR}/keepalived/assets/keepalived.conf
sed -i "s|{{ KEEPALIVED_PRIORITY }}|$KEEPALIVED_PRIORITY|g" ${CONTAINER_SERVICE_DIR}/keepalived/assets/keepalived.conf
sed -i "s|{{ KEEPALIVED_PASSWORD }}|$KEEPALIVED_PASSWORD|g" ${CONTAINER_SERVICE_DIR}/keepalived/assets/keepalived.conf