Ansible - wait for restart

- hosts: all
  become: yes
    - name: Upgrade all installed packages
        name: '*'
        state: latest

    - name: Reboot after update
      command: /sbin/shutdown -r 1 "Reboot after patching"
      async: 0
      poll: 0
      ignore_errors: true

    - name: Wait for server to become available
        delay: 60
        timeout: 500 # This can vary use a timeout that is reasonable for your environment, most VM's will reboot before 500 seconds.