This module can be used to gather facts on either virtual machines or templates which are running in your VMware vSphere cluster:
- name: Gather facts on all VMs in the cluster vmware_vm_facts: hostname: "{{ vsphere_host }}" username: "{{ vsphere_username }}" password: "{{ vsphere_password }}" vm_type: "vm" delegate_to: "localhost" register: vm_facts
The previous example gathers information on just the virtual machines that have been created with our cluster and registers the results as the vm_facts variable. If we wanted to find information on just the templates, we could update vm_type to template, or we could list all virtual machines and templates by updating vm_type to all.