Add guest playbooks: ssh hardening, reboot check, auto updates, service check, guest agent, admin user

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JEczyvRjfakkiDNkbZA7PR
This commit is contained in:
Harwinder Sekhon
2026-09-06 20:27:50 -04:00
parent 3f4b067014
commit 7ff69de8c4
6 changed files with 724 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
---
# Installs and enables the QEMU guest agent on VMs (group "vms") so Proxmox
# can query IPs, quiesce filesystems for snapshots and shut the VM down cleanly.
# The VM also needs the agent enabled on the Proxmox side:
# qm set <vmid> --agent enabled=1 (then power-cycle the VM once)
- name: VM Guest Agent - Install and enable qemu-guest-agent
hosts: vms
become: true
gather_facts: true
tasks:
- name: Install qemu-guest-agent
ansible.builtin.package:
name: qemu-guest-agent
state: present
- name: Check whether the guest agent virtio port is present
ansible.builtin.stat:
path: /dev/virtio-ports/org.qemu.guest_agent.0
register: agent_port
- name: Enable and start qemu-guest-agent
ansible.builtin.systemd:
name: qemu-guest-agent
enabled: true
state: started
when: agent_port.stat.exists
- name: Warn when the agent device is missing
ansible.builtin.debug:
msg: "WARNING: {{ inventory_hostname }} has no guest agent device - run 'qm set <vmid> --agent enabled=1' on the Proxmox host and power-cycle the VM"
when: not agent_port.stat.exists
- name: Summary
ansible.builtin.debug:
msg: >-
{{ inventory_hostname }} ({{ ansible_virtualization_type | default('unknown') }}) -
qemu-guest-agent {{ 'RUNNING' if agent_port.stat.exists else 'NOT AVAILABLE' }}