vmware.vmware_rest.vcenter_vmtemplate_libraryitems module – Manage virtual machine templates in vCenter content libraries.
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_vmtemplate_libraryitems.
New in vmware.vmware_rest 5.0.0
DEPRECATED
- Removed in:
version 6.0.0
- Why:
This functionality has been moved to vmware.vmware.
- Alternative:
Use vmware.vmware.deploy_content_library_template or vmware.vmware.content_template instead.
Synopsis
Create and deploy virtual machine template library items in VMware vCenter content libraries.
Use
state=presentto create a new library item by capturing an existing virtual machine as a virtual machine template.Use
state=deployto deploy a new virtual machine from an existing virtual machine template library item onto a target resource pool, host, or cluster.This module will always report a change in check mode.
Library items cannot be updated due to API limitations
Parameters
Parameter |
Comments |
|---|---|
Description for the new library item. If not set, the new library item inherits the description of the source virtual machine. This property was added in vSphere API 6.8. |
|
Default storage specification for the virtual machine template’s disks. Applies to any disk not listed in disk_storage_overrides. If neither disk_storage nor disk_storage_overrides is set, the disks are placed on the default storage backing associated with the library given in library. This property was added in vSphere API 6.8. |
|
Identifier of the datastore for the template’s disks. Must be an identifier (MOID) for a This suboption is currently required. If storage_policy is also set and is incompatible with this datastore, the disk is flagged as out of compliance with that storage policy. This property was added in vSphere API 6.8. |
|
Storage policy for the template’s disks. If not set, datastore must be specified and the disks use the default storage policy of that datastore. This property was added in vSphere API 6.8. |
|
Identifier of the storage policy to use. Must be an identifier (MOID) for a Only relevant when type is This property was added in vSphere API 6.8. |
|
Policy type to apply to the template’s disks. USE_SPECIFIED_POLICY - Use the storage policy given in policy. This property was added in vSphere API 6.8. Choices:
|
|
Per-disk storage specifications for the virtual machine template. Specified as a mapping of source virtual machine disk identifiers (MOIDs of Disks not listed here fall back to disk_storage, or to the library’s default storage backing if disk_storage is also unset. This property was added in vSphere API 6.8. |
|
Guest customization to apply to the deployed virtual machine. Applies when This property was added in vSphere API 6.8. |
|
Name of an existing guest customization specification to apply. If not set, no guest customization is performed. This property was added in vSphere API 6.8. |
|
Hardware changes to apply to the deployed virtual machine. Applies when This property was added in vSphere API 6.8. |
|
CPU changes to apply to the deployed virtual machine. If not set, the deployed virtual machine keeps the template’s CPU settings. This property was added in vSphere API 6.8. |
|
Number of cores per socket for the deployed virtual machine. If not set, the deployed virtual machine keeps the template’s cores-per-socket value. This property was added in vSphere API 6.8. |
|
Number of virtual processors for the deployed virtual machine. If not set, the deployed virtual machine keeps the template’s CPU count. This property was added in vSphere API 6.8. |
|
Identifiers of disks to remove from the deployed virtual machine. Each entry must be an identifier (MOID) for a If not set, all disks are copied to the deployed virtual machine. This property was added in vSphere API 6.8. |
|
Per-disk update specifications for the deployed virtual machine, keyed by disk identifier (MOID of a If not set, disks keep the same settings as the corresponding disks in the template. This property was added in vSphere API 6.8. |
|
Memory changes to apply to the deployed virtual machine. If not set, the deployed virtual machine keeps the template’s memory settings. This property was added in vSphere API 6.8. |
|
Memory size for the deployed virtual machine, in MB. If not set, the deployed virtual machine keeps the template’s memory size. This property was added in vSphere API 6.8. |
|
Mapping of Ethernet adapters to update, keyed by adapter identifier (MOID of a If not set, all adapters stay connected to the same networks as in the template. An adapter with a manual MAC address keeps its address; adapters with generated or assigned MAC addresses receive new addresses. This property was added in vSphere API 6.8. |
|
Identifier of the content library in which the new library item should be created. Must be an identifier (MOID) for a Required when This property was added in vSphere API 6.8. |
|
When When Required for both This property was added in vSphere API 6.8. |
|
Placement information for the virtual machine template. This suboption is currently required. Each specified value is used for placement. If the values, or the values combined with the placement of the source virtual machine, are contradictory, the operation fails. This property was added in vSphere API 6.8. |
|
Identifier of the cluster to place the template on. Must be an identifier (MOID) for a If resource_pool is also set, it must belong to this cluster. If host is also set, it must be a member of this cluster. It is recommended to leave this unset when resource_pool or host is specified. This property was added in vSphere API 6.8. |
|
Identifier of the virtual machine folder to place the template in. Must be an identifier (MOID) for a If not set, the template is placed in the same folder as the source virtual machine. This property was added in vSphere API 6.8. |
|
Identifier of the host to place the template on. Must be an identifier (MOID) for a If resource_pool is also set, it must belong to this host. If cluster is also set, this host must be a member of that cluster. May be omitted if resource_pool or cluster is set. If not set, the system attempts to choose a suitable host; the operation fails if one cannot be chosen. This property was added in vSphere API 6.8. |
|
Identifier of the resource pool to place the template in. Must be an identifier (MOID) for a If not set, the system attempts to choose a suitable resource pool; the operation fails if one cannot be chosen. This property was added in vSphere API 6.8. |
|
Whether the deployed virtual machine should be powered on after deployment. Applies when This property was added in vSphere API 6.8. Choices:
|
|
Timeout in seconds for the whole operation including connection establishment, request sending, and response. Default: |
|
Identifier of the source virtual machine to create the library item from. Must be an identifier (MOID) for a Required when This property was added in vSphere API 6.8. |
|
The desired state of the resource. Use Use Only Choices:
|
|
Tags to attach to the deployed virtual machine. Applies when This property was added in vSphere API 9.1.0.0. |
|
Identifier of the vSphere tag to attach. If both tag_id and tag_name_spec are set, they must refer to the same vSphere tag. Required if tag_name_spec is not set. This property was added in vSphere API 9.1.0.0. |
|
Identifies the tag to attach by its name and category. If both tag_id and tag_name_spec are set, they must refer to the same vSphere tag. Required if tag_id is not set. This property was added in vSphere API 9.1.0.0. |
|
The name of the vSphere category that the tag belongs to. This property was added in vSphere API 9.1.0.0. |
|
The name of the tag to attach. This property was added in vSphere API 9.1.0.0. |
|
Identifier of the template library item to deploy from. Must be an identifier (MOID) for a Required when |
|
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:
|
|
Storage location for the virtual machine template’s configuration and log files. If not set, the configuration and log files are placed on the default storage backing associated with the library given in library. This property was added in vSphere API 6.8. |
|
Identifier of the datastore that holds the template’s configuration and log files. Must be an identifier (MOID) for a This suboption is currently required. If storage_policy is also set and is incompatible with this datastore, the template is flagged as out of compliance with that storage policy. This property was added in vSphere API 6.8. |
|
Storage policy for the template’s configuration and log files. If not set, datastore must be specified and the configuration and log files use the default storage policy of that datastore. This property was added in vSphere API 6.8. |
|
Identifier of the storage policy to use. Must be an identifier (MOID) for a Only relevant when type is This property was added in vSphere API 6.8. |
|
Policy type to apply to the template’s configuration and log files. USE_SPECIFIED_POLICY - Use the storage policy given in policy. This property was added in vSphere API 6.8. Choices:
|
Notes
Note
Generated from vSphere API spec 9.1.0.
Not compatible with vSphere API 7.0.3.
Not compatible with vSphere API 8.0.2.
Examples
- name: Create a VM template library item from an existing virtual machine
vmware.vmware_rest.vcenter_vmtemplate_libraryitems:
name: my-vm-template
source_vm: vm-1001
library: 570bdaa2-5f0a-45c8-8bb5-1234567890ab
placement:
folder: group-v1002
resource_pool: resgroup-1003
state: present
- name: Create a VM template library item with a specific home datastore
vmware.vmware_rest.vcenter_vmtemplate_libraryitems:
name: my-vm-template
description: Golden image for web servers
source_vm: vm-1001
library: 570bdaa2-5f0a-45c8-8bb5-1234567890ab
vm_home_storage:
datastore: datastore-1004
disk_storage:
datastore: datastore-1004
placement:
resource_pool: resgroup-1003
state: present
- name: Deploy a virtual machine from a template library item
vmware.vmware_rest.vcenter_vmtemplate_libraryitems:
template_library_item: 8a5f1c2d-9b3e-4f6a-8c7d-abcdef012345
name: deployed-vm
powered_on: true
placement:
folder: group-v1002
resource_pool: resgroup-1003
state: deploy
- name: Deploy a virtual machine with CPU and memory customization
vmware.vmware_rest.vcenter_vmtemplate_libraryitems:
template_library_item: 8a5f1c2d-9b3e-4f6a-8c7d-abcdef012345
name: deployed-vm-custom
powered_on: true
placement:
resource_pool: resgroup-1003
hardware_customization:
cpu_update:
num_cpus: 4
num_cores_per_socket: 2
memory_update:
memory: 8192
state: deploy
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
Identifier of the managed resource. When When Returned: When state is present, or when state is set to a supported action Sample: |
|
The raw API response body from the vCenter operation. When When Returned: On success Sample: |
Status
This module will be removed in version 6.0.0. [deprecated]
For more information see DEPRECATED.