---
- name: Update APT package cache
  apt: update_cache=yes
- name: Upgrade APT to the lastest packages
  apt: upgrade=safe
- name: Set locale
  command: /usr/sbin/update-locale LC_ALL=en_US.utf8

---
- name: Update APT package cache
  apt: update_cache=yes
- name: Upgrade APT to the lastest packages
  apt: upgrade=safe
- name: Set locale
  command: /usr/sbin/update-locale LC_ALL=en_US.utf8
- name: Rebooting machine so new kernel is active
  command: shutdown -r now removes=/var/run/reboot-required
  async: 0
  poll: 0
  ignore_errors: true
  register: restarted
- name: Waiting for reboot...
  local_action: wait_for host={{ ansible_ssh_host | default(inventory_hostname) }} search_regex=OpenSSH port={{ ansible_ssh_port }} delay=15 state=started
  sudo: no
  when: restarted.changed

Reboot after packages have been upgraded.
Reboot after packages have been upgraded.
