26 lines
696 B
YAML
26 lines
696 B
YAML
---
|
|
- name: Update apt cache
|
|
ansible.builtin.apt:
|
|
update_cache: yes
|
|
cache_valid_time: 3600
|
|
when: ansible_os_family == "Debian"
|
|
|
|
- name: Check for available updates
|
|
ansible.builtin.command: apt list --upgradable
|
|
register: apt_updates
|
|
changed_when: false
|
|
when: ansible_os_family == "Debian"
|
|
|
|
- name: Display available updates
|
|
ansible.builtin.debug:
|
|
msg: "Available updates: {{ apt_updates.stdout_lines | length - 1 }} packages"
|
|
when: apt_updates is defined
|
|
|
|
- name: Perform system update if requested
|
|
ansible.builtin.apt:
|
|
upgrade: safe
|
|
autoremove: yes
|
|
autoclean: yes
|
|
when:
|
|
- ansible_os_family == "Debian"
|
|
- perform_system_update | default(false) |