minor fix in 23.backup.yml

pull/658/head
gjmzj 2019-07-25 22:43:47 +08:00
parent 6724ebb324
commit a8b892c6c0
1 changed files with 5 additions and 4 deletions

View File

@ -4,7 +4,7 @@
- hosts: - hosts:
- localhost - localhost
tasks: tasks:
# 寻找etcd集群中第一个健康节点 # step1: find a healthy member in the etcd cluster
- name: set NODE_IPS of the etcd cluster - name: set NODE_IPS of the etcd cluster
set_fact: NODE_IPS="{% for host in groups['etcd'] %}{{ host }} {% endfor %}" set_fact: NODE_IPS="{% for host in groups['etcd'] %}{{ host }} {% endfor %}"
@ -18,6 +18,7 @@
endpoint health; \ endpoint health; \
done' done'
register: ETCD_CLUSTER_STATUS register: ETCD_CLUSTER_STATUS
ignore_errors: true
- debug: var="ETCD_CLUSTER_STATUS.stdout" - debug: var="ETCD_CLUSTER_STATUS.stdout"
@ -27,15 +28,15 @@
- debug: var="RUNNING_NODE.stdout" - debug: var="RUNNING_NODE.stdout"
# 在健康etcd节点上执行数据备份 # step2: backup data on the healthy member
- name: 执行etcd 数据备份 - name: make a backup on etcd node
shell: "mkdir -p /etcd_backup && cd /etcd_backup && \ shell: "mkdir -p /etcd_backup && cd /etcd_backup && \
ETCDCTL_API=3 {{ bin_dir }}/etcdctl snapshot save snapshot.db" ETCDCTL_API=3 {{ bin_dir }}/etcdctl snapshot save snapshot.db"
args: args:
warn: false warn: false
delegate_to: "{{ RUNNING_NODE.stdout }}" delegate_to: "{{ RUNNING_NODE.stdout }}"
- name: 获取etcd 数据备份 - name: fetch the backup data
fetch: fetch:
src: /etcd_backup/snapshot.db src: /etcd_backup/snapshot.db
dest: "{{ base_dir }}/.cluster/backup/" dest: "{{ base_dir }}/.cluster/backup/"