Skip to content

Commit

Permalink
Added KEEPALIVED_STATE environment variable. #19
Browse files Browse the repository at this point in the history
  • Loading branch information
saqib-ahmed committed Jun 6, 2018
1 parent 5839771 commit f97ea92
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ See how to [set your own environment variables](#set-your-own-environment-variab

- **KEEPALIVED_COMMAND_LINE_ARGUMENTS** Keepalived command line arguments; Defaults to `--log-detail --dump-conf`

- **KEEPALIVED_STATE** The starting state of keepalived; it can either be MASTER or BACKUP.

### Set your own environment variables

#### Use command line argument
Expand Down
2 changes: 2 additions & 0 deletions image/environment/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ KEEPALIVED_VIRTUAL_IPS:
KEEPALIVED_NOTIFY: /container/service/keepalived/assets/notify.sh

KEEPALIVED_ROUTER_ID: 51

KEEPALIVED_STATE: BACKUP
2 changes: 1 addition & 1 deletion image/service/keepalived/assets/keepalived.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ vrrp_instance VI_1 {
{{ KEEPALIVED_INTERFACE }}
}

state BACKUP
state {{ KEEPALIVED_STATE }}
virtual_router_id {{ KEEPALIVED_ROUTER_ID }}
priority {{ KEEPALIVED_PRIORITY }}
nopreempt
Expand Down
1 change: 1 addition & 0 deletions image/service/keepalived/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ if [ ! -e "$FIRST_START_DONE" ]; then
#
# bootstrap config
#
sed -i "s|{{ KEEPALIVED_STATE }}|$KEEPALIVED_STATE|g" ${CONTAINER_SERVICE_DIR}/keepalived/assets/keepalived.conf
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
Expand Down

0 comments on commit f97ea92

Please sign in to comment.