The best way to interact with your hosts is to use the VMware dynamic inventory plugin, which dynamically queries VMware APIs and tells Ansible what nodes can be managed.
To be able to use this VMware dynamic inventory plugin, you need to enable it first by specifying the following in the
[inventory] enable_plugins = vmware_vm_inventory
Then, create a file that ends in
.vmware.yaml in your working directory.
vmware_vm_inventory script takes in the same authentication information as any VMware module.
Here’s an example of a valid inventory file:
ansible-inventory --list -i <filename>.vmware.yml will create a list of VMware instances that are ready to be configured using Ansible.