configurations-ansible/roles/os-updates/tasks/update_Debian.yml

25 lines
606 B
YAML

- 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:
post_reboot_delay: "{{ os_update_reboot_delay }}"
when:
- apt_update_status.changed
- "os_update_auto_reboot is true"
- name: Shutdown when packages were updated
community.general.shutdown:
delay: "{{ os_update_shutdown_delay }}"
when:
- apt_update_status.changed
- "os_update_auto_shutdown is true"