2022-11-18 18:33:37 +01:00
|
|
|
- name: Update all installed packages
|
|
|
|
apt:
|
|
|
|
name: '*'
|
|
|
|
state: latest
|
|
|
|
update_cache: yes
|
|
|
|
only_upgrade: yes
|
|
|
|
register: apt_update_status
|
|
|
|
|
|
|
|
- name: Remove packages not needed anymore
|
|
|
|
apt:
|
|
|
|
autoremove: yes
|
|
|
|
|
|
|
|
- name: Reboot when packages were updated
|
|
|
|
reboot:
|
2022-11-21 17:29:55 +01:00
|
|
|
post_reboot_delay: "{{ os_update_auto_delay }}"
|
2022-11-18 18:33:37 +01:00
|
|
|
when:
|
|
|
|
- apt_update_status.changed
|
2022-11-21 17:29:55 +01:00
|
|
|
- "os_update_auto == 'reboot'"
|
2022-11-18 18:33:37 +01:00
|
|
|
|
|
|
|
- name: Shutdown when packages were updated
|
|
|
|
community.general.shutdown:
|
2022-11-21 17:29:55 +01:00
|
|
|
delay: "{{ os_update_auto_delay }}"
|
2022-11-18 18:33:37 +01:00
|
|
|
when:
|
|
|
|
- apt_update_status.changed
|
2022-11-21 17:29:55 +01:00
|
|
|
- "os_update_auto == 'shutdown'"
|