vmware.vmware_rest.vcenter_resourcepool module – Creates a resource pool.
Note
This module is part of the vmware.vmware_rest collection (version 4.1.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
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: vmware.vmware_rest.vcenter_resourcepool
.
New in vmware.vmware_rest 0.3.0
Synopsis
Creates a resource pool.
Requirements
The below requirements are needed on the host that executes this module.
vSphere 7.0.3 or greater
python >= 3.6
aiohttp
Parameters
Parameter |
Comments |
---|---|
Resource allocation for CPU. if unset or empty, the CPU allocation of the resource pool will not be changed. Valid attributes are:
If unset or empty, reservation will be set to 0. ([‘present’])
If unset or empty, expandable_reservation will be set to true. ([‘present’])
If unset or empty, limit will be set to -1. ([‘present’])
Accepted value for this field:
There is no unit for this value. It is a relative measure based on the settings for other resource pools. This field is optional and it is only relevant when the value of level is CUSTOM. |
|
Resource allocation for CPU. if unset or empty, the CPU allocation of the resource pool will not be changed. Valid attributes are:
If unset or empty, reservation will be set to 0. ([‘present’])
If unset or empty, expandable_reservation will be set to true. ([‘present’])
If unset or empty, limit will be set to -1. ([‘present’])
Accepted value for this field:
There is no unit for this value. It is a relative measure based on the settings for other resource pools. This field is optional and it is only relevant when the value of level is CUSTOM. |
|
Name of the resource pool. if unset or empty, the name of the resource pool will not be changed. Required with state=[‘present’] |
|
Parent of the created resource pool. When clients pass a value of this structure as a parameter, the field must be the id of a resource returned by vmware.vmware_rest.vcenter_resourcepool_info. Required with state=[‘present’] |
|
Identifier of the resource pool to be deleted. The parameter must be the id of a resource returned by vmware.vmware_rest.vcenter_resourcepool_info. Required with state=[‘absent’, ‘present’] |
|
Timeout settings for client session. The maximal number of seconds for the whole operation including connection establishment, request sending and response. The default value is 300s. |
|
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 |
|
You can use this optional parameter to set the location of a log file. This file will be used to record the HTTP REST interaction. The file will be stored on the host that run the module. 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
Tested on vSphere 7.0.3
Examples
- name: Get the existing resource pools
vmware.vmware_rest.vcenter_resourcepool_info:
register: resource_pools
- name: Create an Ad hoc resource pool
vmware.vmware_rest.vcenter_resourcepool:
name: my_resource_pool
parent: '{{ resource_pools.value[0].resource_pool }}'
cpu_allocation:
expandable_reservation: true
limit: 40
reservation: 0
shares:
level: NORMAL
memory_allocation:
expandable_reservation: false
limit: 2000
reservation: 0
shares:
level: NORMAL
register: my_resource_pool
- name: Remove a resource pool
vmware.vmware_rest.vcenter_resourcepool:
resource_pool: '{{ my_resource_pool.id }}'
state: absent
- name: Create a generic resource pool
vmware.vmware_rest.vcenter_resourcepool:
name: my_resource_pool
parent: '{{ resource_pools.value[0].resource_pool }}'
register: my_resource_pool
- name: Modify a resource pool
vmware.vmware_rest.vcenter_resourcepool:
resource_pool: '{{ my_resource_pool.id }}'
cpu_allocation:
expandable_reservation: true
limit: -1
reservation: 0
shares:
level: NORMAL
memory_allocation:
expandable_reservation: false
limit: 1000
reservation: 0
shares:
level: NORMAL
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
moid of the resource Returned: On success Sample: |
|
Create a generic resource pool Returned: On success Sample: |