vmware.vmware_rest.vcenter_resourcepool module – Manage 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.
New in vmware.vmware_rest 5.0.0
Synopsis
Create, update, and delete VMware vCenter resource pools.
A resource pool is a logical abstraction for flexible management of CPU and memory resources within a cluster or host. Resource pools can be nested to create a hierarchy for fine-grained resource allocation.
Use this module to provision new resource pools, adjust CPU and memory allocations, or remove existing resource pools from the vCenter inventory.
Parameters
Parameter |
Comments |
|---|---|
Resource allocation for CPU. This property was added in __vSphere API 7.0.0.0__. If missing or ‘null’ or empty, use the default CPU allocation specification. |
|
In a resource pool with an expandable reservation, the reservation can grow beyond the specified value, if the parent resource pool has unreserved resources. A non-expandable reservation is called a fixed reservation. This property was added in __vSphere API 7.0.0.0__. If missing or ‘null’ or empty, *Vcenter.ResourcePool.ResourceAllocationCreateSpec.expandable_reservation* will be set to true. Choices:
|
|
The utilization of a resource pool will not exceed this limit, even if there are available resources. This is typically used to ensure a consistent performance of resource pools independent of available resources. If set to -1, then there is no fixed limit on resource usage (only bounded by available resources and shares). Units are MB for memory, and MHz for CPU. This property was added in __vSphere API 7.0.0.0__. If missing or ‘null’ or empty, *Vcenter.ResourcePool.ResourceAllocationCreateSpec.limit* will be set to -1. |
|
Amount of resource that is guaranteed available to a resource pool. Reserved resources are not wasted if they are not used. If the utilization is less than the reservation, the resources can be utilized by other running virtual machines. Units are MB for memory, and MHz for CPU. This property was added in __vSphere API 7.0.0.0__. If missing or ‘null’ or empty, *Vcenter.ResourcePool.ResourceAllocationCreateSpec.reservation* will be set to 0. |
|
Shares are used in case of resource contention. This property was added in __vSphere API 7.0.0.0__. If missing or ‘null’ or empty, *Vcenter.ResourcePool.ResourceAllocationCreateSpec.shares* will be set to ‘*Vcenter.ResourcePool.SharesInfo.Level.NORMAL*’. |
|
The allocation level. It maps to a pre-determined set of numeric values for shares. If the shares value does not map to a predefined size, then the level is set as CUSTOM. LOW - For CPU Shares = 500 * number of virtual CPUs. For Memory Shares = 5 * virtual machine memory size in MB. NORMAL - For CPU Shares = 1000 * number of virtual CPUs. For Memory Shares = 10 * virtual machine memory size in MB. HIGH - For CPU Shares = 2000 * number of virtual CPUs. For Memory Shares = 20 * virtual machine memory size in MB. CUSTOM - If set, in case there is resource contention the server uses the shares value to determine the resource allocation. For more information see *Vcenter.ResourcePool.SharesInfo.Level*. This property was added in __vSphere API 7.0.0.0__. Choices:
|
|
When *Vcenter.ResourcePool.SharesInfo.level* is set to CUSTOM, it is the number of shares allocated. Otherwise, this value is ignored. There is no unit for this value. It is a relative measure based on the settings for other resource pools. This property was added in __vSphere API 7.0.0.0__. This property is optional and it is only relevant when the value of level is *Vcenter.ResourcePool.SharesInfo.Level.CUSTOM*. |
|
Resource allocation for memory. This property was added in __vSphere API 7.0.0.0__. If missing or ‘null’ or empty, use the default memory allocation specification. |
|
In a resource pool with an expandable reservation, the reservation can grow beyond the specified value, if the parent resource pool has unreserved resources. A non-expandable reservation is called a fixed reservation. This property was added in __vSphere API 7.0.0.0__. If missing or ‘null’ or empty, *Vcenter.ResourcePool.ResourceAllocationCreateSpec.expandable_reservation* will be set to true. Choices:
|
|
The utilization of a resource pool will not exceed this limit, even if there are available resources. This is typically used to ensure a consistent performance of resource pools independent of available resources. If set to -1, then there is no fixed limit on resource usage (only bounded by available resources and shares). Units are MB for memory, and MHz for CPU. This property was added in __vSphere API 7.0.0.0__. If missing or ‘null’ or empty, *Vcenter.ResourcePool.ResourceAllocationCreateSpec.limit* will be set to -1. |
|
Amount of resource that is guaranteed available to a resource pool. Reserved resources are not wasted if they are not used. If the utilization is less than the reservation, the resources can be utilized by other running virtual machines. Units are MB for memory, and MHz for CPU. This property was added in __vSphere API 7.0.0.0__. If missing or ‘null’ or empty, *Vcenter.ResourcePool.ResourceAllocationCreateSpec.reservation* will be set to 0. |
|
Shares are used in case of resource contention. This property was added in __vSphere API 7.0.0.0__. If missing or ‘null’ or empty, *Vcenter.ResourcePool.ResourceAllocationCreateSpec.shares* will be set to ‘*Vcenter.ResourcePool.SharesInfo.Level.NORMAL*’. |
|
The allocation level. It maps to a pre-determined set of numeric values for shares. If the shares value does not map to a predefined size, then the level is set as CUSTOM. LOW - For CPU Shares = 500 * number of virtual CPUs. For Memory Shares = 5 * virtual machine memory size in MB. NORMAL - For CPU Shares = 1000 * number of virtual CPUs. For Memory Shares = 10 * virtual machine memory size in MB. HIGH - For CPU Shares = 2000 * number of virtual CPUs. For Memory Shares = 20 * virtual machine memory size in MB. CUSTOM - If set, in case there is resource contention the server uses the shares value to determine the resource allocation. For more information see *Vcenter.ResourcePool.SharesInfo.Level*. This property was added in __vSphere API 7.0.0.0__. Choices:
|
|
When *Vcenter.ResourcePool.SharesInfo.level* is set to CUSTOM, it is the number of shares allocated. Otherwise, this value is ignored. There is no unit for this value. It is a relative measure based on the settings for other resource pools. This property was added in __vSphere API 7.0.0.0__. This property is optional and it is only relevant when the value of level is *Vcenter.ResourcePool.SharesInfo.Level.CUSTOM*. |
|
Name of the resource pool. This property was added in __vSphere API 7.0.0.0__. |
|
The parent resource pool under which to create this resource pool. Must be the MOID (managed object identifier) of an existing This property was added in __vSphere API 7.0.0.0__. |
|
Identifier of the resource pool to manage. Must be an identifier (MOID) for a |
|
Timeout in seconds for the whole operation including connection establishment, request sending, and response. Default: |
|
The desired state of the resource. Use Use Choices:
|
|
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:
|
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: Create a basic resource pool
vmware.vmware_rest.vcenter_resourcepool:
name: my_resource_pool
parent: resgroup-1001
state: present
register: my_resource_pool
- name: Create a resource pool with CPU and memory limits
vmware.vmware_rest.vcenter_resourcepool:
name: limited_pool
parent: resgroup-1001
cpu_allocation:
reservation: 2000
limit: 8000
expandable_reservation: false
shares:
level: CUSTOM
shares: 4000
memory_allocation:
reservation: 1024
limit: 4096
expandable_reservation: true
shares:
level: HIGH
state: present
- name: Update an existing resource pool
vmware.vmware_rest.vcenter_resourcepool:
resource_pool: '{{ my_resource_pool.id }}'
name: renamed_pool
cpu_allocation:
limit: 16000
state: present
- name: Delete a resource pool
vmware.vmware_rest.vcenter_resourcepool:
resource_pool: '{{ my_resource_pool.id }}'
state: absent
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
MOID of the managed resource pool. Returned: When state is present, or when a resource is deleted, or when state is set to a supported action. Sample: |
|
The raw API response body from the vCenter operation. Returned: On success Sample: |