restart_hosts.yml 742 B

123456789101112131415161718192021222324252627
  1. ---
  2. - name: Restart master system
  3. # https://github.com/ansible/ansible/issues/10616
  4. shell: sleep 2 && shutdown -r now "OpenShift Ansible master rolling restart"
  5. async: 1
  6. poll: 0
  7. ignore_errors: true
  8. become: yes
  9. - name: Wait for master to restart
  10. local_action:
  11. module: wait_for
  12. host="{{ ansible_host }}"
  13. state=started
  14. delay=10
  15. timeout=600
  16. port="{{ ansible_ssh_port }}"
  17. become: no
  18. # Now that ssh is back up we can wait for API on the remote system,
  19. # avoiding some potential connection issues from local system:
  20. - name: Wait for master API to come back online
  21. wait_for:
  22. host: "{{ openshift.common.hostname }}"
  23. state: started
  24. delay: 10
  25. port: "{{ openshift.master.api_port }}"