pez-infra/ansible/playbooks/update-all.yml
Rasmus "Pez" Wejlgaard d3b516c594
Some checks are pending
Deploy (on merge) / Discover hosts (push) Waiting to run
Deploy (on merge) / Deploy → (push) Blocked by required conditions
fix: cleanup freebsd and alpine stuff (#105)
2026-05-12 22:43:12 +01:00

30 lines
843 B
YAML

---
# Update all hosts (apt upgrade).
# Usage: ansible-playbook playbooks/update-all.yml
- name: Update Linux hosts (apt)
hosts: linux
ignore_unreachable: true
tags: [update, linux]
tasks:
- name: Apt update + upgrade + autoremove
ansible.builtin.apt:
update_cache: true
upgrade: dist
autoremove: true
autoclean: true
register: apt_result
- name: Show upgrade summary
ansible.builtin.debug:
msg: "{{ apt_result.stdout_lines | default(['No output']) }}"
- name: Check if reboot is required
ansible.builtin.stat:
path: /var/run/reboot-required
register: reboot_required
- name: Notify if reboot needed
ansible.builtin.debug:
msg: "WARNING: REBOOT REQUIRED on {{ inventory_hostname }}"
when: reboot_required.stat.exists