ansible-collections/vmware.vmware_rest

Unable to lookup vm_moid or vcenter_vm_info a VM Template not in Content Library

jeffmcutter opened this issue · 1 comments

SUMMARY

Unable to lookup vmware.vmware_rest.vm_moid or vmware.vmware_rest.vcenter_vm_info a VM Template not in a content library.

Related to #453 unable to clone from a VM Template not in a content library.

I'm not sure that vm_moid and vcenter_vm_info should be the way to get it, but I don't see any equivalent for templates which are not in a content library. template_moid and vcenter_template_info would be another option.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

vmware.vmware_rest.vm_moid
vmware.vmware_rest.vcenter_vm_info

ADDITIONAL INFORMATION
---
- name: Lookup test
  hosts: localhost
  gather_facts: false
  tasks:
    - name: Lookup a VM Template
      ansible.builtin.debug:
        msg: "{{ lookup('vmware.vmware_rest.vm_moid', '/Datacenter/templates/vmwrhel1_template') }}"

    - name: Get VM Template info
      vmware.vmware_rest.vcenter_vm_info:
        names:
          - vmwrhel1_template
      register: __template

    - name: Display template
      ansible.builtin.debug:
        var: __template

Unfortunately this is currently limitation in the Vmware REST API, so not doable via this collection. Once API will support it, we will add support.

Here is workaround how to do it via communit.vmware collection.