Fix E306 in roles/etcd (#6515)
This commit is contained in:
parent
058438a25d
commit
648fcf3a2e
4 changed files with 26 additions and 14 deletions
|
@ -1,6 +1,8 @@
|
||||||
---
|
---
|
||||||
- name: Configure | Check if etcd cluster is healthy # noqa 306
|
- name: Configure | Check if etcd cluster is healthy
|
||||||
shell: "{{ bin_dir }}/etcdctl endpoint --cluster status && {{ bin_dir }}/etcdctl endpoint --cluster health 2>&1 | grep -q -v 'Error: unhealthy cluster'"
|
shell: "set -o pipefail && {{ bin_dir }}/etcdctl endpoint --cluster status && {{ bin_dir }}/etcdctl endpoint --cluster health 2>&1 | grep -q -v 'Error: unhealthy cluster'"
|
||||||
|
args:
|
||||||
|
executable: /bin/bash
|
||||||
register: etcd_cluster_is_healthy
|
register: etcd_cluster_is_healthy
|
||||||
failed_when: false
|
failed_when: false
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
@ -16,8 +18,10 @@
|
||||||
ETCDCTL_CACERT: "{{ etcd_cert_dir }}/ca.pem"
|
ETCDCTL_CACERT: "{{ etcd_cert_dir }}/ca.pem"
|
||||||
ETCDCTL_ENDPOINTS: "{{ etcd_access_addresses }}"
|
ETCDCTL_ENDPOINTS: "{{ etcd_access_addresses }}"
|
||||||
|
|
||||||
- name: Configure | Check if etcd-events cluster is healthy # noqa 306
|
- name: Configure | Check if etcd-events cluster is healthy
|
||||||
shell: "{{ bin_dir }}/etcdctl endpoint --cluster status && {{ bin_dir }}/etcdctl endpoint --cluster health 2>&1 | grep -q -v 'Error: unhealthy cluster'"
|
shell: "set -o pipefail && {{ bin_dir }}/etcdctl endpoint --cluster status && {{ bin_dir }}/etcdctl endpoint --cluster health 2>&1 | grep -q -v 'Error: unhealthy cluster'"
|
||||||
|
args:
|
||||||
|
executable: /bin/bash
|
||||||
register: etcd_events_cluster_is_healthy
|
register: etcd_events_cluster_is_healthy
|
||||||
failed_when: false
|
failed_when: false
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
@ -73,8 +77,10 @@
|
||||||
ignore_errors: "{{ etcd_events_cluster_is_healthy.rc == 0 }}"
|
ignore_errors: "{{ etcd_events_cluster_is_healthy.rc == 0 }}"
|
||||||
when: is_etcd_master and etcd_events_cluster_setup
|
when: is_etcd_master and etcd_events_cluster_setup
|
||||||
|
|
||||||
- name: Configure | Wait for etcd cluster to be healthy # noqa 306
|
- name: Configure | Wait for etcd cluster to be healthy
|
||||||
shell: "{{ bin_dir }}/etcdctl endpoint --cluster status && {{ bin_dir }}/etcdctl endpoint --cluster health 2>&1 | grep -q -v 'Error: unhealthy cluster'"
|
shell: "set -o pipefail && {{ bin_dir }}/etcdctl endpoint --cluster status && {{ bin_dir }}/etcdctl endpoint --cluster health 2>&1 | grep -q -v 'Error: unhealthy cluster'"
|
||||||
|
args:
|
||||||
|
executable: /bin/bash
|
||||||
register: etcd_cluster_is_healthy
|
register: etcd_cluster_is_healthy
|
||||||
until: etcd_cluster_is_healthy.rc == 0
|
until: etcd_cluster_is_healthy.rc == 0
|
||||||
retries: "{{ etcd_retries }}"
|
retries: "{{ etcd_retries }}"
|
||||||
|
@ -94,8 +100,10 @@
|
||||||
ETCDCTL_CACERT: "{{ etcd_cert_dir }}/ca.pem"
|
ETCDCTL_CACERT: "{{ etcd_cert_dir }}/ca.pem"
|
||||||
ETCDCTL_ENDPOINTS: "{{ etcd_access_addresses }}"
|
ETCDCTL_ENDPOINTS: "{{ etcd_access_addresses }}"
|
||||||
|
|
||||||
- name: Configure | Wait for etcd-events cluster to be healthy # noqa 306
|
- name: Configure | Wait for etcd-events cluster to be healthy
|
||||||
shell: "{{ bin_dir }}/etcdctl endpoint --cluster status && {{ bin_dir }}/etcdctl endpoint --cluster health 2>&1 | grep -q -v 'Error: unhealthy cluster'"
|
shell: "set -o pipefail && {{ bin_dir }}/etcdctl endpoint --cluster status && {{ bin_dir }}/etcdctl endpoint --cluster health 2>&1 | grep -q -v 'Error: unhealthy cluster'"
|
||||||
|
args:
|
||||||
|
executable: /bin/bash
|
||||||
register: etcd_events_cluster_is_healthy
|
register: etcd_events_cluster_is_healthy
|
||||||
until: etcd_events_cluster_is_healthy.rc == 0
|
until: etcd_events_cluster_is_healthy.rc == 0
|
||||||
retries: "{{ etcd_retries }}"
|
retries: "{{ etcd_retries }}"
|
||||||
|
|
|
@ -139,8 +139,8 @@
|
||||||
inventory_hostname in groups['k8s-cluster']) and
|
inventory_hostname in groups['k8s-cluster']) and
|
||||||
sync_certs|default(false) and inventory_hostname not in groups['etcd']
|
sync_certs|default(false) and inventory_hostname not in groups['etcd']
|
||||||
|
|
||||||
- name: Gen_certs | Copy certs on nodes # noqa 306
|
- name: Gen_certs | Copy certs on nodes
|
||||||
shell: "base64 -d <<< '{{ etcd_node_certs.stdout|quote }}' | tar xz -C {{ etcd_cert_dir }}"
|
shell: "set -o pipefail && base64 -d <<< '{{ etcd_node_certs.stdout|quote }}' | tar xz -C {{ etcd_cert_dir }}"
|
||||||
args:
|
args:
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
no_log: true
|
no_log: true
|
||||||
|
|
|
@ -24,8 +24,10 @@
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
|
|
||||||
- name: Join Member | Ensure member is in etcd-events cluster # noqa 306
|
- name: Join Member | Ensure member is in etcd-events cluster
|
||||||
shell: "{{ bin_dir }}/etcdctl member list | grep -q {{ etcd_events_access_address }}"
|
shell: "set -o pipefail && {{ bin_dir }}/etcdctl member list | grep -q {{ etcd_events_access_address }}"
|
||||||
|
args:
|
||||||
|
executable: /bin/bash
|
||||||
register: etcd_events_member_in_cluster
|
register: etcd_events_member_in_cluster
|
||||||
changed_when: false
|
changed_when: false
|
||||||
check_mode: no
|
check_mode: no
|
||||||
|
|
|
@ -25,8 +25,10 @@
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
|
|
||||||
- name: Join Member | Ensure member is in etcd cluster # noqa 306
|
- name: Join Member | Ensure member is in etcd cluster
|
||||||
shell: "{{ bin_dir }}/etcdctl member list | grep -q {{ etcd_access_address }}"
|
shell: "set -o pipefail && {{ bin_dir }}/etcdctl member list | grep -q {{ etcd_access_address }}"
|
||||||
|
args:
|
||||||
|
executable: /bin/bash
|
||||||
register: etcd_member_in_cluster
|
register: etcd_member_in_cluster
|
||||||
changed_when: false
|
changed_when: false
|
||||||
check_mode: no
|
check_mode: no
|
||||||
|
|
Loading…
Reference in a new issue