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