---
- name: Restart master system
  # https://github.com/ansible/ansible/issues/10616
  shell: sleep 2 && shutdown -r now "OpenShift Ansible master rolling restart"
  async: 1
  poll: 0
  ignore_errors: true
  become: yes

- name: Wait for master to restart
  local_action:
    module: wait_for
      host="{{ inventory_hostname }}"
      state=started
      delay=10
  become: no

# Now that ssh is back up we can wait for API on the remote system,
# avoiding some potential connection issues from local system:
- name: Wait for master API to come back online
  wait_for:
    host: "{{ openshift.common.hostname }}"
    state: started
    delay: 10
    port: "{{ openshift.master.api_port }}"

---
- name: Restart master system
  # https://github.com/ansible/ansible/issues/10616
  shell: sleep 2 && shutdown -r now "OpenShift Ansible master rolling restart"
  async: 1
  poll: 0
  ignore_errors: true
  become: yes

- name: Wait for master to restart
  local_action:
    module: wait_for
      host="{{ ansible_host }}"
      state=started
      delay=10
      timeout=600
  become: no

# Now that ssh is back up we can wait for API on the remote system,
# avoiding some potential connection issues from local system:
- name: Wait for master API to come back online
  wait_for:
    host: "{{ openshift.common.hostname }}"
    state: started
    delay: 10
    port: "{{ openshift.master.api_port }}"

Fix host when waiting for a master system restart.
Fix host when waiting for a master system restart.

Discovered situations where the inventory hostname may not be resolvable
with operations. Switching to the ssh host (an IP) should always be
correct.
