|
|
@ -1,6 +1,6 @@ |
|
|
|
--- |
|
|
|
- name: Configure | Check if etcd cluster is healthy |
|
|
|
shell: "{{ bin_dir }}/etcdctl cluster-health | grep -q 'cluster is healthy'" |
|
|
|
shell: "{{ bin_dir }}/etcdctl endpoint --cluster status && {{ bin_dir }}/etcdctl endpoint --cluster health 2>&1 | grep -q -v 'Error: unhealthy cluster'" |
|
|
|
register: etcd_cluster_is_healthy |
|
|
|
failed_when: false |
|
|
|
changed_when: false |
|
|
@ -10,14 +10,14 @@ |
|
|
|
tags: |
|
|
|
- facts |
|
|
|
environment: |
|
|
|
ETCDCTL_API: 2 |
|
|
|
ETCDCTL_API: 3 |
|
|
|
ETCDCTL_CERT: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}.pem" |
|
|
|
ETCDCTL_KEY: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}-key.pem" |
|
|
|
ETCDCTL_CACERT: "{{ etcd_cert_dir }}/ca.pem" |
|
|
|
ETCDCTL_ENDPOINTS: "{{ etcd_access_addresses }}" |
|
|
|
ETCDCTL_CERT_FILE: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}.pem" |
|
|
|
ETCDCTL_KEY_FILE: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}-key.pem" |
|
|
|
ETCDCTL_CA_FILE: "{{ etcd_cert_dir }}/ca.pem" |
|
|
|
|
|
|
|
- name: Configure | Check if etcd-events cluster is healthy |
|
|
|
shell: "{{ bin_dir }}/etcdctl cluster-health | grep -q 'cluster is healthy'" |
|
|
|
shell: "{{ bin_dir }}/etcdctl endpoint --cluster status && {{ bin_dir }}/etcdctl endpoint --cluster health 2>&1 | grep -q -v 'Error: unhealthy cluster'" |
|
|
|
register: etcd_events_cluster_is_healthy |
|
|
|
failed_when: false |
|
|
|
changed_when: false |
|
|
@ -27,11 +27,11 @@ |
|
|
|
tags: |
|
|
|
- facts |
|
|
|
environment: |
|
|
|
ETCDCTL_API: 2 |
|
|
|
ETCDCTL_API: 3 |
|
|
|
ETCDCTL_CERT: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}.pem" |
|
|
|
ETCDCTL_KEY: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}-key.pem" |
|
|
|
ETCDCTL_CACERT: "{{ etcd_cert_dir }}/ca.pem" |
|
|
|
ETCDCTL_ENDPOINTS: "{{ etcd_events_access_addresses }}" |
|
|
|
ETCDCTL_CERT_FILE: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}.pem" |
|
|
|
ETCDCTL_KEY_FILE: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}-key.pem" |
|
|
|
ETCDCTL_CA_FILE: "{{ etcd_cert_dir }}/ca.pem" |
|
|
|
|
|
|
|
- include_tasks: refresh_config.yml |
|
|
|
when: is_etcd_master |
|
|
@ -74,12 +74,11 @@ |
|
|
|
when: is_etcd_master and etcd_events_cluster_setup |
|
|
|
|
|
|
|
- name: Configure | Wait for etcd cluster to be healthy |
|
|
|
shell: "{{ bin_dir }}/etcdctl --no-sync cluster-health | grep -q 'cluster is healthy'" |
|
|
|
shell: "{{ bin_dir }}/etcdctl endpoint --cluster status && {{ bin_dir }}/etcdctl endpoint --cluster health 2>&1 | grep -q -v 'Error: unhealthy cluster'" |
|
|
|
register: etcd_cluster_is_healthy |
|
|
|
until: etcd_cluster_is_healthy.rc == 0 |
|
|
|
retries: "{{ etcd_retries }}" |
|
|
|
delay: "{{ retry_stagger | random + 3 }}" |
|
|
|
ignore_errors: false |
|
|
|
changed_when: false |
|
|
|
check_mode: no |
|
|
|
run_once: yes |
|
|
@ -89,19 +88,18 @@ |
|
|
|
tags: |
|
|
|
- facts |
|
|
|
environment: |
|
|
|
ETCDCTL_API: 2 |
|
|
|
ETCDCTL_API: 3 |
|
|
|
ETCDCTL_CERT: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}.pem" |
|
|
|
ETCDCTL_KEY: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}-key.pem" |
|
|
|
ETCDCTL_CACERT: "{{ etcd_cert_dir }}/ca.pem" |
|
|
|
ETCDCTL_ENDPOINTS: "{{ etcd_access_addresses }}" |
|
|
|
ETCDCTL_CERT_FILE: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}.pem" |
|
|
|
ETCDCTL_KEY_FILE: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}-key.pem" |
|
|
|
ETCDCTL_CA_FILE: "{{ etcd_cert_dir }}/ca.pem" |
|
|
|
|
|
|
|
- name: Configure | Wait for etcd-events cluster to be healthy |
|
|
|
shell: "{{ bin_dir }}/etcdctl --no-sync cluster-health | grep -q 'cluster is healthy'" |
|
|
|
shell: "{{ bin_dir }}/etcdctl endpoint --cluster status && {{ bin_dir }}/etcdctl endpoint --cluster health 2>&1 | grep -q -v 'Error: unhealthy cluster'" |
|
|
|
register: etcd_events_cluster_is_healthy |
|
|
|
until: etcd_events_cluster_is_healthy.rc == 0 |
|
|
|
retries: "{{ etcd_retries }}" |
|
|
|
delay: "{{ retry_stagger | random + 3 }}" |
|
|
|
ignore_errors: false |
|
|
|
changed_when: false |
|
|
|
check_mode: no |
|
|
|
run_once: yes |
|
|
@ -111,14 +109,14 @@ |
|
|
|
tags: |
|
|
|
- facts |
|
|
|
environment: |
|
|
|
ETCDCTL_API: 2 |
|
|
|
ETCDCTL_API: 3 |
|
|
|
ETCDCTL_CERT: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}.pem" |
|
|
|
ETCDCTL_KEY: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}-key.pem" |
|
|
|
ETCDCTL_CACERT: "{{ etcd_cert_dir }}/ca.pem" |
|
|
|
ETCDCTL_ENDPOINTS: "{{ etcd_events_access_addresses }}" |
|
|
|
ETCDCTL_CERT_FILE: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}.pem" |
|
|
|
ETCDCTL_KEY_FILE: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}-key.pem" |
|
|
|
ETCDCTL_CA_FILE: "{{ etcd_cert_dir }}/ca.pem" |
|
|
|
|
|
|
|
- name: Configure | Check if member is in etcd cluster |
|
|
|
shell: "{{ bin_dir }}/etcdctl --no-sync member list | grep -q {{ etcd_access_address }}" |
|
|
|
shell: "{{ bin_dir }}/etcdctl member list | grep -q {{ etcd_access_address }}" |
|
|
|
register: etcd_member_in_cluster |
|
|
|
ignore_errors: true |
|
|
|
changed_when: false |
|
|
@ -127,14 +125,14 @@ |
|
|
|
tags: |
|
|
|
- facts |
|
|
|
environment: |
|
|
|
ETCDCTL_API: 2 |
|
|
|
ETCDCTL_API: 3 |
|
|
|
ETCDCTL_CERT: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}.pem" |
|
|
|
ETCDCTL_KEY: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}-key.pem" |
|
|
|
ETCDCTL_CACERT: "{{ etcd_cert_dir }}/ca.pem" |
|
|
|
ETCDCTL_ENDPOINTS: "{{ etcd_access_addresses }}" |
|
|
|
ETCDCTL_CERT_FILE: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}.pem" |
|
|
|
ETCDCTL_KEY_FILE: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}-key.pem" |
|
|
|
ETCDCTL_CA_FILE: "{{ etcd_cert_dir }}/ca.pem" |
|
|
|
|
|
|
|
- name: Configure | Check if member is in etcd-events cluster |
|
|
|
shell: "{{ bin_dir }}/etcdctl --no-sync member list | grep -q {{ etcd_access_address }}" |
|
|
|
shell: "{{ bin_dir }}/etcdctl member list | grep -q {{ etcd_access_address }}" |
|
|
|
register: etcd_events_member_in_cluster |
|
|
|
ignore_errors: true |
|
|
|
changed_when: false |
|
|
@ -143,11 +141,11 @@ |
|
|
|
tags: |
|
|
|
- facts |
|
|
|
environment: |
|
|
|
ETCDCTL_API: 2 |
|
|
|
ETCDCTL_API: 3 |
|
|
|
ETCDCTL_CERT: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}.pem" |
|
|
|
ETCDCTL_KEY: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}-key.pem" |
|
|
|
ETCDCTL_CACERT: "{{ etcd_cert_dir }}/ca.pem" |
|
|
|
ETCDCTL_ENDPOINTS: "{{ etcd_events_access_addresses }}" |
|
|
|
ETCDCTL_CERT_FILE: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}.pem" |
|
|
|
ETCDCTL_KEY_FILE: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}-key.pem" |
|
|
|
ETCDCTL_CA_FILE: "{{ etcd_cert_dir }}/ca.pem" |
|
|
|
|
|
|
|
- name: Configure | Join member(s) to etcd cluster one at a time |
|
|
|
include_tasks: join_etcd_member.yml |
|
|
|