增加/删除etcd节点成功后配置重启apiserver

pull/505/head
gjmzj 2019-03-27 21:58:36 +08:00
parent b652d0ad62
commit d24ea510b8
1 changed files with 6 additions and 0 deletions

View File

@ -114,6 +114,9 @@ function add-etcd() {
# check if playbook runs successfully # check if playbook runs successfully
ansible-playbook $BASEPATH/tools/19.addetcd.yml -e NODE_TO_ADD=$1 || { sed -i "/$1 NODE_NAME=$NAME/d" $BASEPATH/hosts; return 2; } ansible-playbook $BASEPATH/tools/19.addetcd.yml -e NODE_TO_ADD=$1 || { sed -i "/$1 NODE_NAME=$NAME/d" $BASEPATH/hosts; return 2; }
# restart apiservers to use the new etcd cluster
ansible-playbook $BASEPATH/04.kube-master.yml -t restart_master || { echo "[ERROR] Unexpected failures in master nodes!"; return 2; }
# save current cluster context if needed # save current cluster context if needed
save_context save_context
} }
@ -125,6 +128,9 @@ function del-etcd() {
# #
ansible-playbook $BASEPATH/tools/remove_etcd_node.yml -e ETCD_TO_DEL=$1 ansible-playbook $BASEPATH/tools/remove_etcd_node.yml -e ETCD_TO_DEL=$1
# restart apiservers to use the new etcd cluster
ansible-playbook $BASEPATH/04.kube-master.yml -t restart_master || { echo "[ERROR] Unexpected failures in master nodes!"; return 2; }
# save current cluster context if needed # save current cluster context if needed
save_context save_context
} }