diff --git a/changelogs/fragments/4287-fix-proxmox-vm-chek.yml b/changelogs/fragments/4287-fix-proxmox-vm-chek.yml new file mode 100644 index 0000000000..0e5d578a24 --- /dev/null +++ b/changelogs/fragments/4287-fix-proxmox-vm-chek.yml @@ -0,0 +1,2 @@ +bugfixes: + - proxmox_kvm - fix error when checking whether Proxmox VM exists (https://github.com/ansible-collections/community.general/pull/4287). diff --git a/plugins/modules/cloud/misc/proxmox_kvm.py b/plugins/modules/cloud/misc/proxmox_kvm.py index 4230960347..67dd422e97 100644 --- a/plugins/modules/cloud/misc/proxmox_kvm.py +++ b/plugins/modules/cloud/misc/proxmox_kvm.py @@ -1205,7 +1205,7 @@ def main(): proxmox.get_vm(vmid) # Ensure the choosen VM name doesn't already exist when cloning - existing_vmid = proxmox.get_vmid(name, choose_first_if_multiple=True) + existing_vmid = proxmox.get_vmid(name, ignore_missing=True, choose_first_if_multiple=True) if existing_vmid: module.exit_json(changed=False, vmid=existing_vmid, msg="VM with name <%s> already exists" % name)