main.yml 833 B

12345678910111213141516171819202122232425262728293031
  1. - name: Clear our set_facts
  2. set_fact:
  3. reboot_force: false
  4. - name: Workaround arm64 repo issue
  5. ansible.builtin.lineinfile:
  6. path: /etc/apt/apt.conf.d/99phased-updates
  7. create: yes
  8. state: present
  9. insertbefore: BOF
  10. line: 'APT::Get::Always-Include-Phased-Updates 1;'
  11. - name: Repo updates
  12. apt:
  13. update_cache: yes
  14. changed_when: false
  15. - name: OS updates
  16. apt:
  17. upgrade: safe
  18. register: updates_os_change
  19. - name: Remember to reboot if the OS says so
  20. stat:
  21. path: /var/run/reboot-required
  22. register: updates_os_flag
  23. - name: Remember our OS update status
  24. set_fact:
  25. reboot_force: "{{ updates_os_change.changed or updates_os_flag.stat.exists }}"
  26. when: reboot_force is not defined or updates_os_change.changed or updates_os_flag.stat.exists
  27. - name: Pacakge cleanup
  28. apt:
  29. autoremove: yes