You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.2 KiB

  1. ---
  2. - name: Check for etcdctl binary
  3. raw: "test -e {{ bin_dir }}/etcdctl"
  4. register: test_etcdctl
  5. - name: Set has_etcdctl fact
  6. set_fact:
  7. has_etcdctl: "{{ test_etcdctl.rc == 0 | bool }}"
  8. - name: Check if etcd cluster is healthy
  9. shell: "{{ bin_dir }}/etcdctl --endpoints={{ etcd_access_addresses }} cluster-health | grep -q 'cluster is healthy'"
  10. register: etcd_cluster_health
  11. ignore_errors: true
  12. changed_when: false
  13. check_mode: no
  14. environment:
  15. ETCDCTL_CERT_FILE: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}.pem"
  16. ETCDCTL_KEY_FILE: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}-key.pem"
  17. ETCDCTL_CA_FILE: "{{ etcd_cert_dir }}/ca.pem"
  18. when: has_etcdctl
  19. - name: Set etcd_cluster_is_healthy fact
  20. set_fact:
  21. etcd_cluster_is_healthy: "{{ etcd_cluster_health.rc == 0 | bool }}"
  22. - name: Abort if etcd cluster is healthy and old_etcd_members is undefined
  23. assert:
  24. that: "{{ old_etcd_members is defined }}"
  25. msg: "'old_etcd_members' must be defined when the etcd cluster has quorum."
  26. when: etcd_cluster_is_healthy
  27. - name: Warn for untested recovery
  28. debug:
  29. msg: Control plane recovery of split control planes is UNTESTED! Abort or continue at your own risk.
  30. delay: 30
  31. when: not control_plane_is_converged