Documentation

vmware_vm_inventory - VMware Guest inventory source

New in version 2.6.

Synopsis

  • Get virtual machines as inventory hosts from VMware environment.
  • Uses any file which ends with vmware.yml or vmware.yaml as a YAML configuration file.
  • The inventory_hostname is always the ‘Name’ and UUID of the virtual machine. UUID is added as VMware allows virtual machines with the same name.

Requirements

The below requirements are needed on the local master node that executes this inventory.

  • Python >= 2.7
  • PyVmomi
  • requests >= 2.3
  • vSphere Automation SDK - For tag feature
  • vCloud Suite SDK - For tag feature

Parameters

Parameter Choices/Defaults Configuration Comments
cache
boolean
Default:
no
ini entries:

[inventory]
cache = no

env:ANSIBLE_INVENTORY_CACHE
Toggle to enable/disable the caching of the inventory's source data, requires a cache plugin setup to work.
cache_connection
ini entries:

[inventory]
cache_connection = VALUE

env:ANSIBLE_INVENTORY_CACHE_CONNECTION
Cache connection data or path, read cache plugin documentation for specifics.
cache_plugin
ini entries:

[inventory]
cache_plugin = VALUE

env:ANSIBLE_INVENTORY_CACHE_PLUGIN
Cache plugin to use for the inventory's source data.
cache_timeout
integer
Default:
3600
ini entries:

[inventory]
cache_timeout = 3600

env:ANSIBLE_INVENTORY_CACHE_TIMEOUT
Cache duration in seconds
hostname
required
env:VMWARE_SERVER
Name of vCenter or ESXi server.
password
required
env:VMWARE_PASSWORD
Password of vSphere admin user.
port Default:
443
env:VMWARE_PORT
Port number used to connect to vCenter or ESXi Server.
username
required
env:VMWARE_USERNAME
Name of vSphere admin user.
validate_certs
boolean
Default:
yes
Allows connection when SSL certificates are not valid. Set to false when certificates are not trusted.
with_tags
boolean
Default:
no
Include tags and associated virtual machines.
Requires 'vSphere Automation SDK' and 'vCloud Suite SDK' libraries to be installed on the given controller machine.
Please refer following URLs for installation steps
https://code.vmware.com/web/sdk/65/vsphere-automation-python
https://code.vmware.com/web/sdk/60/vcloudsuite-python

Examples

# Sample configuration file for VMware Guest dynamic inventory
    plugin: vmware_vm_inventory
    strict: False
    hostname: 10.65.223.31
    username: administrator@vsphere.local
    password: Esxi@123$%
    validate_certs: False
    with_tags: True

Status

Author

  • Abhijeet Kasurde (@Akasurde)

Hint

If you notice any issues in this documentation you can edit this document to improve it.