From 7abf6a6958702d7407c5c2a9c5b21509ac849c1d Mon Sep 17 00:00:00 2001 From: Matthew Mosesohn Date: Wed, 7 Aug 2019 14:44:50 +0300 Subject: [PATCH] Allow etcd member join by checking cluster health only on first etcd (#5032) Change-Id: I9cc01cef3a437893225e2d9f58495826bbce7be9 --- roles/etcd/tasks/configure.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/roles/etcd/tasks/configure.yml b/roles/etcd/tasks/configure.yml index 2470217bc..e3f9c31dd 100644 --- a/roles/etcd/tasks/configure.yml +++ b/roles/etcd/tasks/configure.yml @@ -64,7 +64,7 @@ when: is_etcd_master and etcd_events_cluster_setup - name: Configure | Check if etcd cluster is healthy - shell: "{{ bin_dir }}/etcdctl --endpoints={{ etcd_access_addresses }} cluster-health | grep -q 'cluster is healthy'" + shell: "{{ bin_dir }}/etcdctl --no-sync --endpoints={{ etcd_client_url }} cluster-health | grep -q 'cluster is healthy'" register: etcd_cluster_is_healthy until: etcd_cluster_is_healthy.rc == 0 retries: 4 @@ -72,7 +72,11 @@ ignore_errors: false changed_when: false check_mode: no - when: is_etcd_master and etcd_cluster_setup + delegate_to: "{{ groups['etcd'][0] }}" + run_once: yes + when: + - is_etcd_master + - etcd_cluster_setup tags: - facts environment: @@ -81,7 +85,7 @@ ETCDCTL_CA_FILE: "{{ etcd_cert_dir }}/ca.pem" - name: Configure | Check if etcd-events cluster is healthy - shell: "{{ bin_dir }}/etcdctl --endpoints={{ etcd_events_access_addresses }} cluster-health | grep -q 'cluster is healthy'" + shell: "{{ bin_dir }}/etcdctl --no-sync --endpoints={{ etcd_events_client_url }} cluster-health | grep -q 'cluster is healthy'" register: etcd_events_cluster_is_healthy until: etcd_events_cluster_is_healthy.rc == 0 retries: 4 @@ -89,7 +93,12 @@ ignore_errors: false changed_when: false check_mode: no - when: is_etcd_master and etcd_events_cluster_setup + delegate_to: "{{ groups['etcd'][0] }}" + run_once: yes + when: + - is_etcd_master + - etcd_events_cluster_setup + - etcd_cluster_setup tags: - facts environment: