From d0c7938a48f414be4d098d1e3af5e4906243bace Mon Sep 17 00:00:00 2001 From: gjmzj Date: Tue, 26 Nov 2019 03:06:12 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20ectd=E9=9B=86=E7=BE=A4=E6=9C=89=E4=B8=8D?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E8=8A=82=E7=82=B9=E6=97=B6=E5=88=A0=E9=99=A4?= =?UTF-8?q?etcd=E8=8A=82=E7=82=B9=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/11.deletcd.yml | 12 +++++++++--- tools/12.delnode.yml | 2 ++ tools/13.delmaster.yml | 2 ++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/tools/11.deletcd.yml b/tools/11.deletcd.yml index 9bdcd90..71594dc 100644 --- a/tools/11.deletcd.yml +++ b/tools/11.deletcd.yml @@ -34,20 +34,26 @@ - debug: var="ETCD_CLUSTER_STATUS.stdout" + - debug: var="ETCD_CLUSTER_STATUS.stderr" + - name: get a running ectd node - shell: 'echo -e "{{ ETCD_CLUSTER_STATUS.stdout }}"|grep "is healthy"|sed -n "1p"|cut -d: -f2|cut -d/ -f3' + shell: 'echo -e "{{ ETCD_CLUSTER_STATUS.stdout }}" \ + "{{ ETCD_CLUSTER_STATUS.stderr }}" \ + |grep "is healthy"|sed -n "1p"|cut -d: -f2|cut -d/ -f3' register: RUNNING_NODE - debug: var="RUNNING_NODE.stdout" # step2: remove jobs run on the healthy member if needed - name: get ID of etcd node to delete - shell: "ETCDCTL_API=3 {{ bin_dir }}/etcdctl member list|grep {{ ETCD_TO_DEL }}:2380|cut -d',' -f1" + shell: "ETCDCTL_API=3 {{ bin_dir }}/etcdctl member list \ + |grep {{ ETCD_TO_DEL }}:2380|cut -d',' -f1" register: ETCD_ID delegate_to: "{{ RUNNING_NODE.stdout }}" - name: get NAME of etcd node to delete - shell: "ETCDCTL_API=3 {{ bin_dir }}/etcdctl member list|grep {{ ETCD_TO_DEL }}:2380|cut -d' ' -f3|cut -d',' -f1" + shell: "ETCDCTL_API=3 {{ bin_dir }}/etcdctl member list \ + |grep {{ ETCD_TO_DEL }}:2380|cut -d' ' -f3|cut -d',' -f1" register: ETCD_NAME delegate_to: "{{ RUNNING_NODE.stdout }}" diff --git a/tools/12.delnode.yml b/tools/12.delnode.yml index d217ec2..c186e43 100644 --- a/tools/12.delnode.yml +++ b/tools/12.delnode.yml @@ -20,6 +20,8 @@ - debug: var="CLEAN_STATUS.stdout" + - debug: var="CLEAN_STATUS.stderr" + - name: run kubectl delete node {{ NODE_TO_DEL }} shell: "{{ bin_dir }}/kubectl delete node {{ NODE_TO_DEL }}" ignore_errors: true diff --git a/tools/13.delmaster.yml b/tools/13.delmaster.yml index db2996d..85bd4fa 100644 --- a/tools/13.delmaster.yml +++ b/tools/13.delmaster.yml @@ -21,6 +21,8 @@ - debug: var="CLEAN_STATUS.stdout" + - debug: var="CLEAN_STATUS.stderr" + - name: run kubectl delete node {{ NODE_TO_DEL }} shell: "{{ bin_dir }}/kubectl delete node {{ NODE_TO_DEL }}" ignore_errors: true