Ubuntu: streamline nightly update playbook

- Merge proxmox and hardware plays into one play
- Replace serial: 1 with throttle: 1 so an unreachable host no longer aborts the run
- Restart qemu-guest-agent only via handler when the package changes
- Combine cache update, upgrade, autoremove and autoclean into one apt task
- Move net-tools install to inst-vm-core.yaml

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
JustinandClaude Opus 5.5 committed 2026-11-17 15:29:43 -06:00
1 parent 011d427182
commit 8de2386aa1
2 files changed
+27 -56

No files matched your search

+1
View File
@@ -10,6 +10,7 @@
- prometheus-node-exporter - prometheus-node-exporter
- nfs-common - nfs-common
- qemu-guest-agent - qemu-guest-agent
- net-tools
update_cache: true update_cache: true
- name: Start guest qemu-guest-agent - name: Start guest qemu-guest-agent
+26 -56
View File
@@ -1,72 +1,42 @@
--- ---
- name: Proxmox Update and upgrade apt packages - name: Update and upgrade apt packages
hosts: proxmox hosts: proxmox:hardware
become: yes become: true
serial: 1 gather_subset: [min]
tasks: handlers:
- name: Restart qemu-guest-agent
- name: Update packages with apt
when: ansible_facts['pkg_mgr'] == 'apt'
ansible.builtin.apt:
update_cache: true
cache_valid_time: 3600
lock_timeout: 600
- name: Installing proxmox guest agent
when: ansible_facts['pkg_mgr'] == 'apt'
ansible.builtin.apt:
name: qemu-guest-agent
state: latest
- name: Enable and restart proxmox agent
ansible.builtin.service: ansible.builtin.service:
name: qemu-guest-agent name: qemu-guest-agent
state: restarted state: restarted
- name: Upgrade packages with apt
when: ansible_facts['pkg_mgr'] == 'apt'
ansible.builtin.apt:
upgrade: dist
- name: Clean up packages with apt
when: ansible_facts['pkg_mgr'] == 'apt'
ansible.builtin.apt:
autoclean: true
autoremove: true
- name: Hardware Update and upgrade apt packages
hosts: hardware
become: yes
tasks: tasks:
- name: Apt maintenance
- name: Update packages with apt
when: ansible_facts['pkg_mgr'] == 'apt' when: ansible_facts['pkg_mgr'] == 'apt'
block:
- name: Ensure qemu-guest-agent is installed
when: inventory_hostname in groups['proxmox']
ansible.builtin.apt: ansible.builtin.apt:
name: qemu-guest-agent
state: present
update_cache: true update_cache: true
cache_valid_time: 3600 cache_valid_time: 3600
lock_timeout: 600 lock_timeout: 600
notify: Restart qemu-guest-agent
- name: Upgrade packages with apt - name: Ensure qemu-guest-agent is running
when: ansible_facts['pkg_mgr'] == 'apt' when: inventory_hostname in groups['proxmox']
ansible.builtin.service:
name: qemu-guest-agent
state: started
- name: Upgrade packages and clean up
ansible.builtin.apt: ansible.builtin.apt:
update_cache: true
cache_valid_time: 3600
upgrade: dist upgrade: dist
- name: Clean up packages with apt
when: ansible_facts['pkg_mgr'] == 'apt'
ansible.builtin.apt:
autoclean: true
autoremove: true autoremove: true
autoclean: true
- name: installing net-tools on all lock_timeout: 600
hosts: all # One host at a time, but an unreachable host no longer aborts the run like serial: 1 did
become: yes throttle: 1
tasks:
- name: running apt
when: ansible_facts['pkg_mgr'] == 'apt'
ansible.builtin.apt:
name: net-tools
state: latest