- 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]>
43 lines
1.2 KiB
YAML
43 lines
1.2 KiB
YAML
---
|
|
- name: Update and upgrade apt packages
|
|
hosts: proxmox:hardware
|
|
become: true
|
|
gather_subset: [min]
|
|
|
|
handlers:
|
|
- name: Restart qemu-guest-agent
|
|
ansible.builtin.service:
|
|
name: qemu-guest-agent
|
|
state: restarted
|
|
|
|
tasks:
|
|
- 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: 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
|
|
autoremove: true
|
|
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
|