The documentation for Dynamic Inventory makes mention of so many dynamic inventories, but none for VMware.
I really liked the feature of tagging servers in Amazon EC2 and was hoping to re-create a similar system in our VMware environment.
Fetch all servers in vSphere with tags "environment=testing" and "application=helloworld" and run this Ansible playbook on them.
There are two in the official Ansible repository:
Refer to the code and the configuration files (
vmware.ini
,vmware_inventory.ini
) for usage details.Alternatively you can fetch the VMs facts with
vmware_vm_facts
module and create your own in-memory inventory withadd_host
.