PARALLAX

vcenter_resourcepool

Creates a resource pool

Collection: vmware.vmware_rest

Full Name: vmware.vmware_rest.vcenter_resourcepool

Synopsis

Creates a resource pool

Parameters

NameTypeRequiredDefaultDescription
vcenter_hostnamestringyesThe hostname or IP address of the vSphere vCenter
If the value is not specified in the task, the value of environment variable C(VMWARE_HOST) will be used instead.
vcenter_usernamestringyesThe vSphere vCenter username
If the value is not specified in the task, the value of environment variable C(VMWARE_USER) will be used instead.
vcenter_passwordstringyesThe vSphere vCenter password
If the value is not specified in the task, the value of environment variable C(VMWARE_PASSWORD) will be used instead.
vcenter_validate_certsbooltrueAllows connection when SSL certificates are not valid. Set to C(false) when certificates are not trusted.
If the value is not specified in the task, the value of environment variable C(VMWARE_VALIDATE_CERTS) will be used instead.
vcenter_rest_log_filestringYou 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 runs the module.
If the value is not specified in the task, the value of
environment variable C(VMWARE_REST_LOG_FILE) will be used instead.
session_timeoutfloatTimeout 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.
cpu_allocationdictResource allocation for CPU.
if unset or empty, the CPU allocation of the resource pool will not be changed.
Valid attributes are:
  • C(reservation) (int): 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 fo memory, and MHz for CPU. If unset or empty, I(reservation) will be set to 0. ([‘present’])
  • C(expandable_reservation) (bool): 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. If unset or empty, I(expandable_reservation) will be set to true. ([‘present’])
  • C(limit) (int): 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. If unset or empty, I(limit) will be set to -1. ([‘present’])
  • C(shares) (dict): Shares are used in case of resource contention. ([‘present’])
    • Accepted keys:
      • level (string): This option defines the possible values for the allocation level. Accepted value for this field:
        • C(CUSTOM)
        • C(HIGH)
        • C(LOW)
        • C(NORMAL)
      • shares (integer): When I(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 field is optional and it is only relevant when the value of I(level) is CUSTOM. | | memory_allocation | dict | | | Resource allocation for CPU. if unset or empty, the CPU allocation of the resource pool will not be changed. Valid attributes are:

  • C(reservation) (int): 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 fo memory, and MHz for CPU. If unset or empty, I(reservation) will be set to 0. ([‘present’])
  • C(expandable_reservation) (bool): 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. If unset or empty, I(expandable_reservation) will be set to true. ([‘present’])
  • C(limit) (int): 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. If unset or empty, I(limit) will be set to -1. ([‘present’])
  • C(shares) (dict): Shares are used in case of resource contention. ([‘present’])
    • Accepted keys:
      • level (string): This option defines the possible values for the allocation level. Accepted value for this field:
        • C(CUSTOM)
        • C(HIGH)
        • C(LOW)
        • C(NORMAL)
      • shares (integer): When I(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 field is optional and it is only relevant when the value of I(level) is CUSTOM. | | name | string | | | Name of the resource pool. if unset or empty, the name of the resource pool will not be changed. Required with I(state=[‘present’]) | | parent | string | | | 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 M(vmware.vmware_rest.vcenter_resourcepool_info). Required with I(state=[‘present’]) | | resource_pool | string | | | Identifier of the resource pool to be deleted. The parameter must be the id of a resource returned by M(vmware.vmware_rest.vcenter_resourcepool_info). Required with I(state=[‘absent’, ‘present’]) | | state | string | | present | Operation to perform; allowed values: absent, present. |

Example

yaml
- 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
Search
    ↑ ↓ move↵ openesc close