restart_hosts.yml 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. - name: Restart master system
  2. # https://github.com/ansible/ansible/issues/10616
  3. shell: sleep 2 && shutdown -r now "OpenShift Ansible master rolling restart"
  4. async: 1
  5. poll: 0
  6. ignore_errors: true
  7. become: yes
  8. # When cluster_method != pacemaker we can ensure the api_port is
  9. # available.
  10. - name: Wait for master API to come back online
  11. become: no
  12. local_action:
  13. module: wait_for
  14. host="{{ inventory_hostname }}"
  15. state=started
  16. delay=10
  17. port="{{ openshift.master.api_port }}"
  18. when: openshift.master.cluster_method != 'pacemaker'
  19. - name: Wait for master to start
  20. become: no
  21. local_action:
  22. module: wait_for
  23. host="{{ inventory_hostname }}"
  24. state=started
  25. delay=10
  26. port=22
  27. when: openshift.master.cluster_method == 'pacemaker'
  28. - name: Wait for master to become available
  29. command: pcs status
  30. register: pcs_status_output
  31. until: pcs_status_output.stdout | validate_pcs_cluster([inventory_hostname]) | bool
  32. retries: 15
  33. delay: 2
  34. changed_when: false
  35. when: openshift.master.cluster_method == 'pacemaker'
  36. - fail:
  37. msg: >
  38. Pacemaker cluster validation failed {{ inventory hostname }} is not online.
  39. when: openshift.master.cluster_method == 'pacemaker' and not (pcs_status_output.stdout | validate_pcs_cluster([inventory_hostname])) | bool