check.yml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. ---
  2. - fail:
  3. msg: "Currently etcd v3 migration is unsupported while we test it more thoroughly"
  4. when: not openshift_enable_unsupported_configurations | default(false) | bool
  5. # Check the cluster is healthy
  6. - include: check_cluster_health.yml
  7. # Check if the member has v3 data already
  8. # Run the migration only if the data are v2
  9. - name: Check if there are any v3 data
  10. command: >
  11. etcdctl --cert {{ etcd_peer_cert_file }} --key {{ etcd_peer_key_file }} --cacert {{ etcd_peer_ca_file }} --endpoints 'https://{{ etcd_peer }}:{{ etcd_client_port }}' get "" --from-key --keys-only -w json --limit 1
  12. environment:
  13. ETCDCTL_API: 3
  14. register: l_etcdctl_output
  15. - fail:
  16. msg: "Unable to get a number of v3 keys"
  17. when: l_etcdctl_output.rc != 0
  18. - fail:
  19. msg: "The etcd has at least one v3 key"
  20. when: "'count' in (l_etcdctl_output.stdout | from_json) and (l_etcdctl_output.stdout | from_json).count != 0"
  21. # TODO(jchaloup): once the until loop can be used over include/block,
  22. # remove the repetive code
  23. # - until loop not supported over include statement (nor block)
  24. # https://github.com/ansible/ansible/issues/17098
  25. # - with_items not supported over block
  26. # Check the cluster status for the first time
  27. - include: check_cluster_status.yml
  28. # Check the cluster status for the second time
  29. - block:
  30. - debug:
  31. msg: "l_etcd_cluster_status_ok: {{ l_etcd_cluster_status_ok }}"
  32. - name: Wait a while before another check
  33. pause:
  34. seconds: 5
  35. when: not l_etcd_cluster_status_ok | bool
  36. - include: check_cluster_status.yml
  37. when: not l_etcd_cluster_status_ok | bool
  38. # Check the cluster status for the third time
  39. - block:
  40. - debug:
  41. msg: "l_etcd_cluster_status_ok: {{ l_etcd_cluster_status_ok }}"
  42. - name: Wait a while before another check
  43. pause:
  44. seconds: 5
  45. when: not l_etcd_cluster_status_ok | bool
  46. - include: check_cluster_status.yml
  47. when: not l_etcd_cluster_status_ok | bool