ansible(node_baseline): don't fail on qemu-guest-agent when no virtio channel (agent disabled in tofu); enable-only

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
jakman85andClaude Opus 4.8 committed 2026-08-25 12:04:19 -05:00
1 parent 1ff25318c9
commit 1004c8eae6
1 file changed
+19 -5
@@ -35,14 +35,28 @@
fs.inotify.max_user_watches = 524288
notify: Reload sysctl
- name: Enable and start iscsid (Longhorn) and qemu-guest-agent
- name: Enable and start iscsid (Longhorn prerequisite)
ansible.builtin.systemd:
name: "{{ item }}"
name: iscsid
enabled: true
state: started
loop:
- iscsid
- qemu-guest-agent
# qemu-guest-agent binds to the virtio-serial channel /dev/virtio-ports/org.qemu.guest_agent.0,
# which Proxmox attaches only when the VM's `agent` option is enabled. Our tofu keeps agent
# DISABLED on purpose (enabling it makes `tofu apply` block up to 15m waiting for an agent the
# stock Debian cloud image hasn't installed yet — bpg gotcha). So we ENABLE the unit for the day
# a channel exists, but only START it when the channel is actually present — never fail the
# baseline over a missing hypervisor channel.
- name: Check whether the qemu guest-agent virtio channel is attached
ansible.builtin.stat:
path: /dev/virtio-ports/org.qemu.guest_agent.0
register: node_baseline_qga_channel
- name: Enable qemu-guest-agent (start only when its virtio channel is present)
ansible.builtin.systemd:
name: qemu-guest-agent
enabled: true
state: "{{ 'started' if node_baseline_qga_channel.stat.exists else 'stopped' }}"
- name: Create ext4 filesystem on the Longhorn data disk (data-safe; skips if present)
community.general.filesystem: