summaryrefslogtreecommitdiffstats
path: root/roles/etcd_migrate/tasks/check_cluster_health.yml
diff options
context:
space:
mode:
authorOpenShift Bot <eparis+openshiftbot@redhat.com>2017-06-18 19:25:04 -0400
committerGitHub <noreply@github.com>2017-06-18 19:25:04 -0400
commitd7be27f7f9321099e52b54afcce2308ac1e1671f (patch)
treedd840473d179259b098d651da0ad73bb642901ce /roles/etcd_migrate/tasks/check_cluster_health.yml
parente2840e8ab50215eb7603a832f2f729d873e5a811 (diff)
parent0fc47e5030577479be08126818dd2b5b5ccdf995 (diff)
downloadopenshift-d7be27f7f9321099e52b54afcce2308ac1e1671f.tar.gz
openshift-d7be27f7f9321099e52b54afcce2308ac1e1671f.tar.bz2
openshift-d7be27f7f9321099e52b54afcce2308ac1e1671f.tar.xz
openshift-d7be27f7f9321099e52b54afcce2308ac1e1671f.zip
Merge pull request #3954 from ingvagabund/etcd-migrate
Merged by openshift-bot
Diffstat (limited to 'roles/etcd_migrate/tasks/check_cluster_health.yml')
-rw-r--r--roles/etcd_migrate/tasks/check_cluster_health.yml23
1 files changed, 23 insertions, 0 deletions
diff --git a/roles/etcd_migrate/tasks/check_cluster_health.yml b/roles/etcd_migrate/tasks/check_cluster_health.yml
new file mode 100644
index 000000000..1abd6a32f
--- /dev/null
+++ b/roles/etcd_migrate/tasks/check_cluster_health.yml
@@ -0,0 +1,23 @@
+---
+- name: Check cluster health
+ command: >
+ etcdctl --cert-file /etc/etcd/peer.crt --key-file /etc/etcd/peer.key --ca-file /etc/etcd/ca.crt --endpoint https://{{ etcd_peer }}:2379 cluster-health
+ register: etcd_cluster_health
+ changed_when: false
+ failed_when: false
+
+- name: Assume a member is not healthy
+ set_fact:
+ etcd_member_healthy: false
+
+- name: Get member item health status
+ set_fact:
+ etcd_member_healthy: true
+ with_items: "{{ etcd_cluster_health.stdout_lines }}"
+ when: "(etcd_peer in item) and ('is healthy' in item)"
+
+- name: Check the etcd cluster health
+ # TODO(jchaloup): should we fail or ask user if he wants to continue? Or just wait until the cluster is healthy?
+ fail:
+ msg: "Etcd member {{ etcd_peer }} is not healthy"
+ when: not etcd_member_healthy