Using VMware dynamic inventory plugin

VMware Dynamic Inventory Plugin

The best way to interact with your hosts is to use the VMware dynamic inventory plugin, which dynamically queries VMware APIs andtells 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 ansible.cfg file:

  1. [inventory]
  2. enable_plugins = vmware_vm_inventory

Then, create a file that ends in .vmware.yml or .vmware.yaml in your working directory.

The vmware_vm_inventory script takes in the same authentication information as any VMware module.

Here’s an example of a valid inventory file:

  1. plugin: vmware_vm_inventory
  2. strict: False
  3. hostname: 10.65.223.31
  4. username: [email protected]
  5. password: [email protected]$%
  6. validate_certs: False
  7. with_tags: True

Executing ansible-inventory —list -i <filename>.vmware.yml will create a list of VMware instances that are ready to be configured using Ansible.

See also