From fbec2ecaa8835cd8936e9968bd9d1b08d241f77e Mon Sep 17 00:00:00 2001 From: Dag Wieers Date: Wed, 4 Jan 2017 10:26:29 +0100 Subject: [PATCH] vmware_guest: Do not match simply by folder (#19823) This fixes #19077 --- lib/ansible/modules/cloud/vmware/vmware_guest.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/cloud/vmware/vmware_guest.py b/lib/ansible/modules/cloud/vmware/vmware_guest.py index c464e33943..0df90394ff 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_guest.py +++ b/lib/ansible/modules/cloud/vmware/vmware_guest.py @@ -641,8 +641,10 @@ class PyVmomiHelper(object): if not isinstance(vobj.parent, vim.Folder): continue if self.compile_folder_path_for_object(vobj) == searchpath: - self.current_vm_obj = vobj - return vobj + # Match by name + if vobj.config.name == name: + self.current_vm_obj = vobj + return vobj if name_match: if name_match == 'first':