diff --git a/plugins/module_utils/proxmox.py b/plugins/module_utils/proxmox.py index 56f0b35e7f..ed40fbe95f 100644 --- a/plugins/module_utils/proxmox.py +++ b/plugins/module_utils/proxmox.py @@ -127,7 +127,8 @@ class ProxmoxAnsible(object): return vms[0] def get_vm(self, vmid, ignore_missing=False): - vms = [vm for vm in self.proxmox_api.cluster.resources.get(type='vm') if vm['vmid'] == int(vmid)] + vmid = int(vmid) if vmid is not None else None + vms = [vm for vm in self.proxmox_api.cluster.resources.get(type='vm') if vmid and vm['vmid'] == vmid] if vms: return vms[0]