Manage a Proxmox VE QEMU VM through the Proxmox API: clone from a template, cloud-init user, SSH keys and network, update only on detected drift, grow the boot disk, apply the power state, wait for SSH and cloud-init, and delete behind pve_vm_allow_destroy. The role never sets a cloud-init password and deletes a stored one with no_log. Inputs are validated first under the always tag: the API credentials, and pve_vm_disk_size while the disk is managed; the clone asserts pve_vm_clone_vmid. Only pve_vm_exists is public, every other fact and register is __pve_vm_. The molecule scenario runs offline on noble and resolute: validation with positive and refusal cases, drift detection over seeded VM configs, and static checks over the role's task files that no proxmox_kvm task or module_defaults entry carries cipassword and that the one task deleting a stored cipassword is no_log. The API lifecycle and the cloud-init wait are not exercised. README Roadmap: the pve_vm wave 2 line and the opnsense and proxmox_firewall line are removed; wave 3 stays. Closes #482 Assisted-by: Claude Code:claude-opus-5-5
32 lines
1.3 KiB
YAML
32 lines
1.3 KiB
YAML
---
|
|
pve_vm_state: present # present | started | stopped | absent
|
|
pve_vm_allow_destroy: false
|
|
pve_vm_full_clone: true
|
|
pve_vm_wait_for_guest: true
|
|
pve_vm_delegate: localhost
|
|
pve_vm_agent: true
|
|
pve_vm_onboot: true
|
|
# Sent on update only; Proxmox does not return it in the VM config, so it is never compared.
|
|
pve_vm_autostart: true
|
|
pve_vm_manage_disk: true
|
|
pve_vm_boot_disk: scsi0
|
|
# Restart the VM after its boot disk was grown.
|
|
pve_vm_reboot_if_required: true
|
|
# Cloud-init (ciuser, sshkeys) is pushed to an existing VM only on other drift, on the first run
|
|
# after a clone, or when this is true: Proxmox stores sshkeys URL-encoded, so a rotated key is not
|
|
# detected as drift.
|
|
pve_vm_force_update: false
|
|
|
|
# Cloud-init user (ciuser). Empty means not sent to Proxmox and not compared for drift.
|
|
pve_vm_ci_user: ""
|
|
|
|
# Proxmox API credentials, asserted in tasks/validate.yml before any change. The user is the bare
|
|
# name: the role appends @<pve_vm_api_realm>. The token secret, pve_vm_api_token_secret, is a secret
|
|
# input with no default, normally vaulted.
|
|
pve_vm_api_user: ""
|
|
pve_vm_api_realm: pam
|
|
pve_vm_api_token_id: "{{ pve_vm_api_user }}-token"
|
|
# The Proxmox node's address. Guarded so the default templates to '' (and the argument validation
|
|
# passes) on a host without pve_vm_node.
|
|
pve_vm_api_host: "{{ hostvars[pve_vm_node].ansible_host if pve_vm_node is defined else '' }}"
|