community.vmware.vmware_resource_pool (4.2.0) — module

Add/remove resource pools to/from vCenter

Authors: Davis Phillips (@dav1x)

Install collection

Install with ansible-galaxy collection install community.vmware:==4.2.0


Add to requirements.yml

  collections:
    - name: community.vmware
      version: 4.2.0

Description

This module can be used to add/remove a resource pool to/from vCenter

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add resource pool to vCenter
  community.vmware.vmware_resource_pool:
    hostname: '{{ vcenter_hostname }}'
    username: '{{ vcenter_username }}'
    password: '{{ vcenter_password }}'
    datacenter: '{{ datacenter_name }}'
    cluster: '{{ cluster_name }}'
    resource_pool: '{{ resource_pool_name }}'
    mem_shares: normal
    mem_limit: -1
    mem_reservation: 0
    mem_expandable_reservations: true
    cpu_shares: normal
    cpu_limit: -1
    cpu_reservation: 0
    cpu_expandable_reservations: true
    state: present
  delegate_to: localhost

Inputs

    
port:
    default: 443
    description:
    - The port number of the vSphere vCenter or ESXi server.
    - If the value is not specified in the task, the value of environment variable E(VMWARE_PORT)
      will be used instead.
    type: int

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Add or remove the resource pool
    type: str

cluster:
    description:
    - Name of the cluster to configure the resource pool.
    - This parameter is required if O(esxi_hostname) or O(parent_resource_pool) is not
      specified.
    - The O(cluster), O(esxi_hostname) and O(parent_resource_pool) parameters are mutually
      exclusive.
    type: str

hostname:
    description:
    - The hostname or IP address of the vSphere vCenter or ESXi server.
    - If the value is not specified in the task, the value of environment variable E(VMWARE_HOST)
      will be used instead.
    type: str

password:
    aliases:
    - pass
    - pwd
    description:
    - The password of the vSphere vCenter or ESXi server.
    - If the value is not specified in the task, the value of environment variable E(VMWARE_PASSWORD)
      will be used instead.
    type: str

username:
    aliases:
    - admin
    - user
    description:
    - The username of the vSphere vCenter or ESXi server.
    - If the value is not specified in the task, the value of environment variable E(VMWARE_USER)
      will be used instead.
    type: str

cpu_limit:
    default: -1
    description:
    - The utilization of a virtual machine/resource pool will not exceed this limit, even
      if there are available resources.
    - The default value -1 indicates no limit.
    type: int

mem_limit:
    default: -1
    description:
    - The utilization of a virtual machine/resource pool will not exceed this limit, even
      if there are available resources.
    - The default value -1 indicates no limit.
    type: int

cpu_shares:
    choices:
    - high
    - custom
    - low
    - normal
    default: normal
    description:
    - Memory shares are used in case of resource contention.
    type: str

datacenter:
    description:
    - Name of the datacenter.
    required: true
    type: str

mem_shares:
    choices:
    - high
    - custom
    - low
    - normal
    default: normal
    description:
    - Memory shares are used in case of resource contention.
    type: str

proxy_host:
    description:
    - Address of a proxy that will receive all HTTPS requests and relay them.
    - The format is a hostname or a IP.
    - If the value is not specified in the task, the value of environment variable E(VMWARE_PROXY_HOST)
      will be used instead.
    required: false
    type: str

proxy_port:
    description:
    - Port of the HTTP proxy that will receive all HTTPS requests and relay them.
    - If the value is not specified in the task, the value of environment variable E(VMWARE_PROXY_PORT)
      will be used instead.
    required: false
    type: int

esxi_hostname:
    description:
    - Name of the host to configure the resource pool.
    - The host must not be member of a cluster.
    - This parameter is required if O(cluster) or O(parent_resource_pool) is not specified.
    - The O(cluster), O(esxi_hostname) and O(parent_resource_pool) parameters are mutually
      exclusive.
    type: str

resource_pool:
    description:
    - Resource pool name to manage.
    required: true
    type: str

validate_certs:
    default: true
    description:
    - Allows connection when SSL certificates are not valid. Set to V(false) when certificates
      are not trusted.
    - If the value is not specified in the task, the value of environment variable E(VMWARE_VALIDATE_CERTS)
      will be used instead.
    type: bool

cpu_reservation:
    default: 0
    description:
    - Amount of resource that is guaranteed available to the virtual machine or resource
      pool.
    type: int

mem_reservation:
    default: 0
    description:
    - Amount of resource that is guaranteed available to the virtual machine or resource
      pool.
    type: int

parent_resource_pool:
    description:
    - Name of the parent resource pool.
    - This parameter is required if O(cluster) or O(esxi_hostname) is not specified.
    - The O(cluster), O(esxi_hostname) and O(parent_resource_pool) parameters are mutually
      exclusive.
    type: str

cpu_allocation_shares:
    default: 4000
    description:
    - The number of cpu shares allocated.
    - This value is only set if O(cpu_shares=custom).
    type: int

mem_allocation_shares:
    default: 163840
    description:
    - The number of memory shares allocated.
    - This value is only set if O(mem_shares=custom).
    type: int

cpu_expandable_reservations:
    default: true
    description:
    - In a resource pool with an expandable reservation, the reservation on a resource
      pool can grow beyond the specified value.
    type: bool

mem_expandable_reservations:
    default: true
    description:
    - In a resource pool with an expandable reservation, the reservation on a resource
      pool can grow beyond the specified value.
    type: bool

Outputs

instance:
  description: metadata about the new resource pool
  returned: always
  sample: None
  type: dict
resource_pool_config:
  description: config data about the resource pool, version added 1.4.0
  returned: always
  sample: "{\n  \"_vimtype\": \"vim.ResourceConfigSpec\",\n  \"changeVersion\": null,\n\
    \  \"cpuAllocation\": {\n    \"_vimtype\": \"vim.ResourceAllocationInfo\",\n \
    \   \"expandableReservation\": true,\n    \"limit\": -1,\n    \"overheadLimit\"\
    : null,\n    \"reservation\": 0,\n    \"shares\": {\n      \"_vimtype\": \"vim.SharesInfo\"\
    ,\n      \"level\": \"normal\",\n      \"shares\": 4000\n    }\n  },\n  \"entity\"\
    : \"vim.ResourcePool:resgroup-1108\",\n  \"lastModified\": null,\n  \"memoryAllocation\"\
    : {\n    \"_vimtype\": \"vim.ResourceAllocationInfo\",\n    \"expandableReservation\"\
    : true,\n    \"limit\": -1,\n    \"overheadLimit\": null,\n    \"reservation\"\
    : 0,\n    \"shares\": {\n      \"_vimtype\": \"vim.SharesInfo\",\n      \"level\"\
    : \"high\",\n      \"shares\": 327680\n    }\n  },\n  \"name\": \"test_pr1\",\n\
    \  \"scaleDescendantsShares\": null\n}"
  type: dict