From 61b18cc3551e5e529529a09b903c11b4570beaa7 Mon Sep 17 00:00:00 2001 From: Abdul Anshad A Date: Wed, 28 Jun 2017 21:17:53 +0530 Subject: [PATCH] fixes issue #5633 (#19716) --- lib/ansible/modules/cloud/vmware/vsphere_guest.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/ansible/modules/cloud/vmware/vsphere_guest.py b/lib/ansible/modules/cloud/vmware/vsphere_guest.py index 1ee92ea1ae..c523af4232 100644 --- a/lib/ansible/modules/cloud/vmware/vsphere_guest.py +++ b/lib/ansible/modules/cloud/vmware/vsphere_guest.py @@ -1893,6 +1893,12 @@ def main(): elif state == 'absent': module.exit_json(changed=False, msg="vm %s not present" % guest) + # check if user is trying to perform state operation on a vm which doesn't exists + elif state in ['present', 'powered_off', 'powered_on'] and not all((vm_extra_config, + vm_hardware, vm_disk, vm_nic, esxi)): + module.exit_json(changed=False, msg="vm %s not present" % guest) + + # Create the VM elif state in ['present', 'powered_off', 'powered_on']: