diff --git a/roles/etcd/tasks/configure.yml b/roles/etcd/tasks/configure.yml index 39df567f64c87449d5739d31ec3225d1fd2f6107..e300d5540602e4bc165d4c55f2d05ed6e9744f03 100644 --- a/roles/etcd/tasks/configure.yml +++ b/roles/etcd/tasks/configure.yml @@ -1,6 +1,8 @@ --- -- name: Configure | Check if etcd cluster is healthy # noqa 306 - shell: "{{ bin_dir }}/etcdctl endpoint --cluster status && {{ bin_dir }}/etcdctl endpoint --cluster health 2>&1 | grep -q -v 'Error: unhealthy cluster'" +- name: Configure | Check if etcd cluster is healthy + 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 failed_when: false changed_when: false @@ -16,8 +18,10 @@ ETCDCTL_CACERT: "{{ etcd_cert_dir }}/ca.pem" ETCDCTL_ENDPOINTS: "{{ etcd_access_addresses }}" -- name: Configure | Check if etcd-events cluster is healthy # noqa 306 - shell: "{{ bin_dir }}/etcdctl endpoint --cluster status && {{ bin_dir }}/etcdctl endpoint --cluster health 2>&1 | grep -q -v 'Error: unhealthy cluster'" +- name: Configure | Check if etcd-events cluster is healthy + 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 failed_when: false changed_when: false @@ -73,8 +77,10 @@ ignore_errors: "{{ etcd_events_cluster_is_healthy.rc == 0 }}" when: is_etcd_master and etcd_events_cluster_setup -- name: Configure | Wait for etcd cluster to be healthy # noqa 306 - shell: "{{ bin_dir }}/etcdctl endpoint --cluster status && {{ bin_dir }}/etcdctl endpoint --cluster health 2>&1 | grep -q -v 'Error: unhealthy cluster'" +- name: Configure | Wait for etcd cluster to be healthy + 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 until: etcd_cluster_is_healthy.rc == 0 retries: "{{ etcd_retries }}" @@ -94,8 +100,10 @@ ETCDCTL_CACERT: "{{ etcd_cert_dir }}/ca.pem" ETCDCTL_ENDPOINTS: "{{ etcd_access_addresses }}" -- name: Configure | Wait for etcd-events cluster to be healthy # noqa 306 - shell: "{{ bin_dir }}/etcdctl endpoint --cluster status && {{ bin_dir }}/etcdctl endpoint --cluster health 2>&1 | grep -q -v 'Error: unhealthy cluster'" +- name: Configure | Wait for etcd-events cluster to be healthy + 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 until: etcd_events_cluster_is_healthy.rc == 0 retries: "{{ etcd_retries }}" diff --git a/roles/etcd/tasks/gen_certs_script.yml b/roles/etcd/tasks/gen_certs_script.yml index 5dd25547dc8d9b462997e5afc62b21f12cf3dbd6..0314ad9d9e4249ba317007640cb3fc86c7a68acc 100644 --- a/roles/etcd/tasks/gen_certs_script.yml +++ b/roles/etcd/tasks/gen_certs_script.yml @@ -139,8 +139,8 @@ inventory_hostname in groups['k8s-cluster']) and sync_certs|default(false) and inventory_hostname not in groups['etcd'] -- name: Gen_certs | Copy certs on nodes # noqa 306 - shell: "base64 -d <<< '{{ etcd_node_certs.stdout|quote }}' | tar xz -C {{ etcd_cert_dir }}" +- name: Gen_certs | Copy certs on nodes + shell: "set -o pipefail && base64 -d <<< '{{ etcd_node_certs.stdout|quote }}' | tar xz -C {{ etcd_cert_dir }}" args: executable: /bin/bash no_log: true diff --git a/roles/etcd/tasks/join_etcd-events_member.yml b/roles/etcd/tasks/join_etcd-events_member.yml index c4de329067c05ec45a779d3dfe896fb83a3583c9..25850f88f6f08361dd1311c85a40e5ab4d2bbba0 100644 --- a/roles/etcd/tasks/join_etcd-events_member.yml +++ b/roles/etcd/tasks/join_etcd-events_member.yml @@ -24,8 +24,10 @@ {%- endif -%} {%- endfor -%} -- name: Join Member | Ensure member is in etcd-events cluster # noqa 306 - shell: "{{ bin_dir }}/etcdctl member list | grep -q {{ etcd_events_access_address }}" +- name: Join Member | Ensure member is in etcd-events cluster + 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 changed_when: false check_mode: no diff --git a/roles/etcd/tasks/join_etcd_member.yml b/roles/etcd/tasks/join_etcd_member.yml index 6793b6957d0d194e6a7d366726aaa3fab97cbcdf..8b40c6e6a4d4a3ebcfc093f8d12bb7387f515eb7 100644 --- a/roles/etcd/tasks/join_etcd_member.yml +++ b/roles/etcd/tasks/join_etcd_member.yml @@ -25,8 +25,10 @@ {%- endif -%} {%- endfor -%} -- name: Join Member | Ensure member is in etcd cluster # noqa 306 - shell: "{{ bin_dir }}/etcdctl member list | grep -q {{ etcd_access_address }}" +- name: Join Member | Ensure member is in etcd cluster + shell: "set -o pipefail && {{ bin_dir }}/etcdctl member list | grep -q {{ etcd_access_address }}" + args: + executable: /bin/bash register: etcd_member_in_cluster changed_when: false check_mode: no