vmware_vm_inventory – VMware Guest inventory source¶
New in version 2.7.
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
|
|
ini entries:
[inventory] 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
string
|
ini entries:
[defaults] [inventory] env:ANSIBLE_CACHE_PLUGIN_CONNECTION
env:ANSIBLE_INVENTORY_CACHE_CONNECTION
|
Cache connection data or path, read cache plugin documentation for specifics.
|
|
cache_plugin
string
|
Default: "memory"
|
ini entries:
[defaults] [inventory] env:ANSIBLE_CACHE_PLUGIN
env:ANSIBLE_INVENTORY_CACHE_PLUGIN
|
Cache plugin to use for the inventory's source data.
|
cache_prefix
-
|
Default: "ansible_inventory_"
|
ini entries:
[default] [inventory] env:ANSIBLE_CACHE_PLUGIN_PREFIX
env:ANSIBLE_INVENTORY_CACHE_PLUGIN_PREFIX
|
Prefix to use for cache plugin files/tables
|
cache_timeout
integer
|
Default: 3600
|
ini entries:
[defaults] [inventory] env:ANSIBLE_CACHE_PLUGIN_TIMEOUT
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: [email protected]
password: Esxi@123$%
validate_certs: False
with_tags: True
Status¶
This inventory is not guaranteed to have a backwards compatible interface. [preview]
This inventory is maintained by the Ansible Community. [community]