Ansible upgrade
An ansible playbook to weekly update all nodes to the latest versions.
- Update the virtual nodes.
- Update the real nodes, one node at a time.
- Check if a reboot is needed, node for node.
After the playbook has run, all nodes should be up-to-date and running.
Note: At the moment all nodes are a Debian distribution:
pve: Debian (Trixie) 13 - Proxmoxlxc: Debian (Trixie) 13 - virtual nodesvm: Debian (Trixie) 13 - virtual nodesraspi: Debian (Bookkworm) 12 - Raspberry Pi 3B
---
- name: Upgrade virtual nodes playbook
hosts: lxc, vm
become: true
gather_facts: false
tasks:
- name: Apt upgrade
ansible.builtin.apt:
upgrade: dist
update_cache: true
autoclean: true
- name: Upgrade real nodes playbook
hosts: pve, raspi
become: true
gather_facts: false
serial: 1
tasks:
- name: Apt upgrade
ansible.builtin.apt:
upgrade: dist
update_cache: true
autoclean: true
- name: Check reboot playbook
hosts: all
become: true
gather_facts: false
serial: 1
tasks:
- name: Check reboot
ansible.builtin.stat:
path: /var/run/reboot-required
register: required
- name: Reboot
ansible.builtin.reboot:
when: required.stat.exists