vmware.vmware_rest.vcenter_vm_info module – Gather information about virtual machines in vCenter.
Note
This module is part of the vmware.vmware_rest collection (version 5.0.0).
You might already have this collection installed if you are using the ansible package.
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install vmware.vmware_rest.
To use it in a playbook, specify: vmware.vmware_rest.vcenter_vm_info.
New in vmware.vmware_rest 5.0.0
DEPRECATED
- Removed in:
version 6.0.0
- Why:
This functionality has been moved to vmware.vmware.vm_info.
- Alternative:
Use vmware.vmware.vm_info instead.
Synopsis
Retrieve information about one or more virtual machines managed by vCenter.
When a virtual machine identifier is supplied, return the full configuration details for that single virtual machine, including its hardware, boot options, CPU, memory, disks, and network adapters.
When no identifier is supplied, return a summary list of virtual machines, optionally narrowed using the available filters such as names, folders, datacenters, hosts, clusters, resource pools, and power states.
Parameters
Parameter |
Comments |
|---|---|
Limit the results to virtual machines contained in these clusters. Each value must be the MOID of a If omitted or empty, virtual machines in any cluster match the filter. |
|
Limit the results to virtual machines contained in these datacenters. Each value must be the MOID of a If omitted or empty, virtual machines in any datacenter match the filter. |
|
Limit the results to virtual machines contained in these folders. Each value must be the MOID of a If omitted or empty, virtual machines in any folder match the filter. |
|
Limit the results to virtual machines running on these hosts. Each value must be the MOID of a If omitted or empty, virtual machines on any host match the filter. |
|
Limit the results to virtual machines with these display names. If omitted or empty, virtual machines with any name match the filter. |
|
Limit the results to virtual machines that are in one of these power states.
If omitted or empty, virtual machines in any power state match the filter. |
|
Limit the results to virtual machines contained in these resource pools. Each value must be the MOID of a If omitted or empty, virtual machines in any resource pool match the filter. |
|
Timeout in seconds for the whole operation including connection establishment, request sending, and response. Default: |
|
The hostname or IP address of the vSphere vCenter. If the value is not specified in the task, the value of environment variable |
|
The vSphere vCenter password. If the value is not specified in the task, the value of environment variable |
|
The port number of the vSphere vCenter. If the value is not specified in the task, the value of environment variable |
|
Optional path to a log file for HTTP REST interaction. If the value is not specified in the task, the value of environment variable |
|
The vSphere vCenter username. If the value is not specified in the task, the value of environment variable |
|
Allows connection when SSL certificates are not valid. Set to If the value is not specified in the task, the value of environment variable Choices:
|
|
Identifier of the virtual machine to retrieve full configuration details for. Must be the MOID (managed object identifier) of a When set, the module returns detailed information about this single virtual machine instead of a summary list. |
|
Limit the results to virtual machines with these identifiers (MOIDs). Each value must be the MOID of a If omitted or empty, virtual machines with any identifier match the filter. |
Notes
Note
Generated from vSphere API spec 9.1.0.
Compatible with vSphere API 7.0.3.
Compatible with vSphere API 8.0.2.
Examples
- name: List all virtual machines
vmware.vmware_rest.vcenter_vm_info:
register: all_vms
- name: Get full details about a specific virtual machine
vmware.vmware_rest.vcenter_vm_info:
vm: vm-1013
register: my_vm
- name: Filter virtual machines by name
vmware.vmware_rest.vcenter_vm_info:
names:
- my_test_vm
register: filtered_vms
- name: Find powered-on virtual machines in specific clusters
vmware.vmware_rest.vcenter_vm_info:
clusters:
- domain-c1007
power_states:
- POWERED_ON
register: running_vms
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
MOID of the queried virtual machine. This is not returned when a single VM is looked up directly by its MOID (using the Returned: When only one resource, with a MOID, was queried. Sample: |
|
A list of virtual machines matching the query. Returned: On success. Sample: |
|
Raw output from the API response. This output is maintained for consistency with version 4.x and earlier of this collection. It is recommended to switch to the info return key for a more consistent and documented output. Returned: On success. Sample: |
Status
This module will be removed in version 6.0.0. [deprecated]
For more information see DEPRECATED.