vmware.vmware_rest.vm_moid lookup does not return moid from vm in subfolder
ewilson57 opened this issue · 1 comments
ewilson57 commented
SUMMARY
vmware.vmware_rest.vm_moid does not return MOID of a vm that is in a subfolder.
ISSUE TYPE
- Bug Report
COMPONENT NAME
vmware_rest/vm_moid_lookup
ANSIBLE VERSION
ansible [core 2.14.5]
config file = None
configured module search path = ['/home/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/ansible/opt/venv/ansible/lib/python3.10/site-packages/ansible
ansible collection location = /home/ansible/.ansible/collections:/usr/share/ansible/collections
executable location = /home/ansible/opt/venv/ansible/bin/ansible
python version = 3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0] (/home/ansible/opt/venv/ansible/bin/python)
jinja version = 3.1.2
libyaml = True
COLLECTION VERSION
Collection Version
------------------ -------
vmware.vmware_rest 2.3.1
CONFIGURATION
CONFIG_FILE() = None
OS / ENVIRONMENT
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.2 LTS (Jammy Jellyfish)"
STEPS TO REPRODUCE
---
- name: Lookup MoIDs of objects
hosts: localhost
gather_facts: false
vars:
vm_name: web01
tasks:
- name: Lookup MoID of the vm
ansible.builtin.debug:
msg: "{{ lookup('vmware.vmware_rest.vm_moid', vm_name) }}"
EXPECTED RESULTS
ok: [localhost] => {
"msg": "vm-664"
}
ACTUAL RESULTS
ok: [localhost] => {
"msg": ""
jeffmcutter commented
I think you need to provide the path to it:
lookup('vmware.vmware_rest.vm_moid', '/Datacenter/templates/vmwrhel1')
Datacenter name is "Datacenter"
VM is in a folder under Datacenter named "templates"
The VM in question is named "vmwrhel1"
This is working for me. I am using 3.0.0.