vmware.vmware_rest.vcenter_resourcepool_info module – Gather information about vCenter resource pools.

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_resourcepool_info.

New in vmware.vmware_rest 5.0.0

Synopsis

  • Retrieve information about one or more VMware vCenter resource pools.

  • Can return a list of all resource pools or detailed information about a specific resource pool identified by its MOID.

  • Use the filter parameters to narrow results by resource pool name, parent resource pool, datacenter, host, or cluster.

Parameters

Parameter

Comments

clusters

list / elements=string

A list of cluster MOIDs to filter the results.

Only resource pools that belong to the specified clusters will be returned.

If omitted or empty, resource pools in any cluster are returned.

datacenters

aliases: filter_datacenters

list / elements=string

A list of datacenter MOIDs to filter the results.

Only resource pools that reside in the specified datacenters will be returned.

If omitted or empty, resource pools in any datacenter are returned.

hosts

list / elements=string

A list of host MOIDs to filter the results.

Only resource pools that belong to the specified hosts will be returned.

If omitted or empty, resource pools on any host are returned.

names

aliases: filter_names

list / elements=string

A list of resource pool names to filter the results.

Only resource pools whose names appear in this list will be returned.

If omitted or empty, resource pools with any name are returned.

parent_resource_pools

list / elements=string

A list of parent resource pool MOIDs to filter the results.

Only resource pools that are children of the specified parent pools will be returned.

If omitted or empty, resource pools under any parent are returned.

resource_pool

string

Identifier of the resource pool to retrieve details for.

Must be an identifier (MOID) for a ResourcePool resource.

resource_pools

list / elements=string

A list of resource pool MOIDs to filter the results.

Only resource pools whose identifiers appear in this list will be returned.

If omitted or empty, resource pools with any identifier are returned.

session_timeout

float

Timeout in seconds for the whole operation including connection establishment, request sending, and response.

Default: 300.0

vcenter_hostname

string / required

The hostname or IP address of the vSphere vCenter.

If the value is not specified in the task, the value of environment variable VMWARE_HOST will be used instead.

vcenter_password

string / required

The vSphere vCenter password.

If the value is not specified in the task, the value of environment variable VMWARE_PASSWORD will be used instead.

vcenter_port

integer

The port number of the vSphere vCenter.

If the value is not specified in the task, the value of environment variable VMWARE_PORT will be used instead.

vcenter_rest_log_file

string

Optional path to a log file for HTTP REST interaction.

If the value is not specified in the task, the value of environment variable VMWARE_REST_LOG_FILE will be used instead.

vcenter_username

string / required

The vSphere vCenter username.

If the value is not specified in the task, the value of environment variable VMWARE_USER will be used instead.

vcenter_validate_certs

boolean

Allows connection when SSL certificates are not valid.

Set to false when certificates are not trusted.

If the value is not specified in the task, the value of environment variable VMWARE_VALIDATE_CERTS will be used instead.

Choices:

  • false

  • true ← (default)

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 resource pools
  vmware.vmware_rest.vcenter_resourcepool_info:
  register: all_resource_pools

- name: Get details about a specific resource pool
  vmware.vmware_rest.vcenter_resourcepool_info:
    resource_pool: resgroup-1009
  register: my_resource_pool

- name: Filter resource pools by name
  vmware.vmware_rest.vcenter_resourcepool_info:
    names:
      - my_resource_pool
  register: filtered_pools

- name: Filter resource pools by cluster
  vmware.vmware_rest.vcenter_resourcepool_info:
    clusters:
      - domain-c1007
  register: cluster_pools

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

id

string

MOID of the queried resource pool.

Returned: When only one resource, with a MOID, was queried.

Sample: "resgroup-1009"

info

list / elements=string

A list of resource pools matching the query.

Returned: On success.

Sample: [{"name": "my_resource_pool", "resource_pool": "resgroup-1009"}]

value

any

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: {"cpu_allocation": {"expandable_reservation": true, "limit": -1, "reservation": 0, "shares": {"level": "NORMAL", "shares": 4000}}, "memory_allocation": {"expandable_reservation": true, "limit": -1, "reservation": 0, "shares": {"level": "NORMAL", "shares": 163840}}, "name": "my_resource_pool", "resource_pools": []}

Authors

  • Ansible Eco Content Team (@eco-ansible-content)