---

- name: Update package cache & dist-upgrade packages
  apt:
    upgrade: dist
    update_cache: yes
  async: 600
  poll: 10

#
# Reboot & wait derived from code written by Martin Eggen.
# https://github.com/ansible/ansible/issues/14413#issuecomment-257887580
# 

- name: Reboot host
  shell: sleep 2 && /sbin/shutdown -r now "Ansible reboot" removes=/var/run/reboot-required
  async: 1
  poll: 0

- name: Wait for host to be ready
  become: no
  connection: local
  local_action: wait_for 
  args:
    host: "{{ ansible_host }}"
    port: "{{ ansible_port | default(22) }}"
    state: started
    delay: 60
    timeout: 180


---

- name: Update package cache & dist-upgrade packages
  apt:
    upgrade: dist
    update_cache: yes
  async: 600
  poll: 10

#
# Reboot & wait derived from code written by Martin Eggen.
# https://github.com/ansible/ansible/issues/14413#issuecomment-257887580
# 

- name: Reboot host
  shell: sleep 2 && /sbin/shutdown -r now "Ansible reboot" 
  args: 
    removes=/var/run/reboot-required
  async: 1
  poll: 0

- name: Wait for host to be ready
  become: no
  connection: local
  local_action: wait_for 
  args:
    host: "{{ ansible_host }}"
    port: "{{ ansible_port | default(22) }}"
    state: started
    delay: 60
    timeout: 180


Update to use args syntax.
Update to use args syntax.