Files
Ansible-Minecraft-Server/roles/05-update/tasks/02-check-system-updates.yml
hcornet 9ea9ac7254
Some checks failed
Ansible Minecraft Server CI/CD / lint (push) Failing after 21s
Ansible Minecraft Server CI/CD / test (push) Has been skipped
Ansible Minecraft Server CI/CD / deploy (push) Has been skipped
check new version
2025-08-27 07:59:19 +02:00

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)