Files
dotmesh-monitor/ansible/upgrade.yml
T
davidandClaude Sonnet 5.5 6f0508fae9 Run apt autoremove as its own task and manage meshfirmware via Ansible
apt's autoremove option is not reliably honoured alongside upgrade:, so
upgrade.yml now runs it separately. meshfirmware is cloned/updated by the
scripts role (as the remote user) from both site.yml and upgrade.yml.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 22:04:47 +00:00

39 lines
1.1 KiB
YAML

---
# apt update + dist-upgrade on meshcore nodes, one host at a time.
# ansible-playbook upgrade.yml [--limit dm-edworth]
# ansible-playbook upgrade.yml -e reboot=true # reboot only nodes that need it
- name: Upgrade packages
hosts: meshcore
become: true
serial: 1
vars:
reboot: false
tasks:
- name: apt update and dist-upgrade
ansible.builtin.apt:
update_cache: true
upgrade: dist
# Separate task: apt's autoremove option is not reliably honoured together with upgrade:
- name: apt autoremove
ansible.builtin.apt:
autoremove: true
- name: Update meshfirmware
ansible.builtin.import_role:
name: scripts
tasks_from: meshfirmware
- name: Check whether a reboot is required
ansible.builtin.stat:
path: /var/run/reboot-required
register: reboot_required
- name: Report reboot status
ansible.builtin.debug:
msg: "{{ inventory_hostname }}: reboot {{ 'required' if reboot_required.stat.exists else 'not required' }}"
- name: Reboot if required
ansible.builtin.reboot:
when: reboot | bool and reboot_required.stat.exists