Dear Community,
Is anyone here using Infrastructure as Code (IaC) to fully automate Proxmox infrastructure with Ansible—not just running occasional playbooks manually, but as a complete CI/CD automation stack?
I’m trying to understand the behavior of the proxmox_kvm module when cloning VMs from a template, specifically regarding idempotency. Out of the box, the module creates duplicate VMs with the same name on every run instead of ensuring the target state.
To work around this, I built a lookup module to check if a VM name already exists, preventing duplicates via a when condition. However, this feels like a workaround for something that should be handled natively.
A few specific points I’m struggling to wrap my head around:
EDIT: The documentation says: "With state=present if vmid not provided and VM with name exists in the cluster then no changes will be made." but this is wrong so I expect it is a bug?
community.proxmox 2.0.0
proxmoxxer 2.3.0
Thanks for your insights!
Is anyone here using Infrastructure as Code (IaC) to fully automate Proxmox infrastructure with Ansible—not just running occasional playbooks manually, but as a complete CI/CD automation stack?
I’m trying to understand the behavior of the proxmox_kvm module when cloning VMs from a template, specifically regarding idempotency. Out of the box, the module creates duplicate VMs with the same name on every run instead of ensuring the target state.
To work around this, I built a lookup module to check if a VM name already exists, preventing duplicates via a when condition. However, this feels like a workaround for something that should be handled natively.
A few specific points I’m struggling to wrap my head around:
- Lack of Idempotency: Running a clone task to ensure a VM exists should be idempotent. Instead, it creates a new VM with a new ID every time.
- Cloning vs. ID lookup: If I pass an existing VM ID to the clone task, Ansible uses that ID as the source to clone from, rather than treating it as the target.
- Non-unique VM names: Proxmox requires VM names to be valid DNS names, but allows duplicate names across a cluster. What is the design rationale behind this?
- Naming conventions: Using hyphens instead of underscores in object keys complicates YAML/JSON handling in Ansible workflows.
- In-flight modifications: It doesn't seem possible to alter settings (like expanding disk size) directly within the clone task.
EDIT: The documentation says: "With state=present if vmid not provided and VM with name exists in the cluster then no changes will be made." but this is wrong so I expect it is a bug?
community.proxmox 2.0.0
proxmoxxer 2.3.0
Thanks for your insights!
Last edited: