vmware.vmware_rest.vcenter_ovf_libraryitem module – Manage OVF packages 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_ovf_libraryitem.
New in vmware.vmware_rest 5.0.0
Synopsis
Create, deploy, and inspect OVF packages stored in VMware vCenter content libraries.
Use
state=presentto export a virtual machine or virtual appliance as an OVF package into a content library item.Use
state=deployto deploy an OVF package from a content library item into a new virtual machine or virtual appliance on a target resource pool.Use
state=filterto retrieve deployment information from an OVF package, such as network and storage requirements, EULAs, and additional parameters needed before deploying.
Parameters
Parameter |
Comments |
|---|---|
Specification for creating the OVF package in the content library. Allows overriding the name and description stored in the OVF descriptor. Only used when |
|
Description to use in the OVF descriptor stored in the library item. If omitted, the server will use source’s current annotation. |
|
Flags to use for OVF package creation. If omitted, no flags will be used. |
|
MOID of a source library item used for image identification. This property was added in __vSphere API 9.1.0.0__. If omitted, no source identifier will be used. |
|
Name to use in the OVF descriptor stored in the library item. If omitted, the server will use source’s current name. |
|
Specification controlling how an OVF package is deployed to a resource pool. Includes settings for naming, networking, storage, and EULA acceptance. Only used when |
|
Whether to accept all End User License Agreements included in the OVF package. Use Choices:
|
|
Additional OVF parameters that may be needed for the deployment. These parameters may be required by the OVF descriptor of the OVF package. Use Examples include deployment options, extra config, IP allocation, OVF properties, scale out, and vCenter extension parameters. If omitted, the server will choose default settings for all parameters necessary for the deploy operation. |
|
Unique identifier describing the type of the OVF parameters. The value is the name of the OVF parameters schema. This property must be provided in the input parameters when deploying an OVF package. This property will always be present in the result when retrieving information about an OVF package. |
|
Annotation assigned to the deployed target virtual machine or virtual appliance. If omitted, the server will use the annotation from the OVF package. |
|
MOID of the default datastore to use for all storage sections in the OVF descriptor. If omitted, the server will choose the default datastore. |
|
Flags to use for deployment. If omitted, no flags will be used. |
|
The locale to use for parsing the OVF descriptor. If omitted, the server locale will be used. |
|
Name assigned to the deployed target virtual machine or virtual appliance. If omitted, the server will use the name from the OVF package. |
|
Mapping of OVF network names to vCenter network MOIDs. The key is the network name from the OVF descriptor and the value is the MOID of the target vCenter network. If omitted, the server will choose a network mapping. |
|
Mapping of OVF storage group names to target storage specifications. The key is the storage group name from the OVF descriptor and the value is the target storage specification. If omitted, the server will choose a storage mapping. |
|
MOID of the default storage profile to use for all storage sections in the OVF descriptor. If omitted, the server will choose the default profile. |
|
Default storage provisioning type to use for all sections of type vmw:StorageSection in the OVF descriptor. thin - A thin provisioned virtual disk has space allocated and zeroed on demand as the space is used. thick - A thick provisioned virtual disk has all space allocated at creation time and the space is zeroed on demand as the space is used. eagerZeroedThick - An eager zeroed thick provisioned virtual disk has all space allocated and wiped clean of any previous contents on the physical media at creation time. Disks specified as eager zeroed thick may take longer time to create than disks specified with the other disk provisioning types. If omitted, the server will choose the provisioning type. Choices:
|
|
Mapping of OVF network names to vCenter subnet folder MOIDs. The key is the network name from the OVF descriptor and the value is the MOID of the target subnet folder. If set, this takes precedence over network_mappings. This property was added in __vSphere API 9.1.0.0__. If omitted, network_mappings will be used instead. |
|
Tag parameters that contain the information required to attach tags to a VM during VM deployment. This property was added in __vSphere API 9.1.0.0__. This property is optional because it was added in a newer version than its parent node. |
|
List of tag parameters which contains information required to attach tags while deploying a VM. This property was added in __vSphere API 9.1.0.0__. This property is not used for the ‘create’ operation. It will always be present in the response of the ‘get’ or ‘list’ operations. It is not used for the ‘update’ operation. |
|
Unique identifier describing the type of the OVF parameters. The value is the name of the OVF parameters schema. This property must be provided in the input parameters when deploying an OVF package. This property will always be present in the result when retrieving information about an OVF package. |
|
Virtual machine configuration settings to use in place of those defined in the OVF descriptor. When set, the OVF descriptor is used only for disk definitions, while hardware specifications come from this configuration. Other deployment spec settings such as name, storage_mappings, storage_profile_id, storage_provisioning, and default_datastore_id still apply and are not overridden. This property was added in __vSphere API 8.0.2.0__. If omitted, the virtual machine specifications from the OVF descriptor will be used. |
|
The format provider for the VM configuration specification.
This property was added in __vSphere API 8.0.2.0__. Choices:
|
|
A vim.vm.ConfigSpec serialized to XML and base64 encoded. This property was added in __vSphere API 8.0.2.0__. Only relevant when provider is set to |
|
Identifier of the OVF library item to manage. Required when |
|
Timeout in seconds for the whole operation including connection establishment, request sending, and response. Default: |
|
The virtual machine or virtual appliance to export as an OVF package. Required when |
|
MOID of the source virtual machine or virtual appliance to export. |
|
Type of the source resource to export. Must be one of |
|
The desired state of the resource. Use Use Use Only Choices:
|
|
The destination for the operation. When When When |
|
MOID of the vCenter folder that should contain the virtual machine or virtual appliance. The folder must be a virtual machine folder. If omitted, the server will choose the deployment folder. |
|
MOID of the target host on which the virtual machine or virtual appliance will run. The target host must be a member of the cluster that contains the resource pool identified by resource_pool_id. If omitted, the server will automatically select a target host from the resource pool when it is a stand-alone host or a cluster with DRS enabled. |
|
MOID of the content library in which a new library item should be created. Not used if library_item_id is specified. This property is currently required when |
|
MOID of an existing library item to update with the new OVF package. If omitted, a new library item will be created. library_id must be specified if this property is set. |
|
MOID of the resource pool to which the virtual machine or virtual appliance should be deployed. |
|
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.
Not compatible with vSphere API 7.0.3.
Not compatible with vSphere API 8.0.2.
Examples
- name: Export a virtual machine to a content library as an OVF package
vmware.vmware_rest.vcenter_ovf_libraryitem:
source:
type: VirtualMachine
id: vm-123
target:
library_id: lib-456
create_spec:
name: my-vm-template
description: OVF export of my production web server
state: present
- name: Export a virtual machine into an existing library item
vmware.vmware_rest.vcenter_ovf_libraryitem:
source:
type: VirtualMachine
id: vm-123
target:
library_id: lib-456
library_item_id: item-789
create_spec:
name: my-vm-template
state: present
- name: Deploy an OVF package from a content library item
vmware.vmware_rest.vcenter_ovf_libraryitem:
ovf_library_item_id: item-789
target:
resource_pool_id: resgroup-1001
folder_id: group-v1002
host_id: host-1003
deployment_spec:
name: deployed-vm
accept_all_eula: true
storage_provisioning: thin
network_mappings:
VM Network: network-1004
state: deploy
- name: Deploy an OVF package with a specific datastore and storage profile
vmware.vmware_rest.vcenter_ovf_libraryitem:
ovf_library_item_id: item-789
target:
resource_pool_id: resgroup-1001
deployment_spec:
name: deployed-vm-custom-storage
accept_all_eula: true
default_datastore_id: datastore-1005
storage_profile_id: storageprofile-1006
storage_provisioning: eagerZeroedThick
state: deploy
- name: Retrieve OVF deployment information before deploying
vmware.vmware_rest.vcenter_ovf_libraryitem:
ovf_library_item_id: item-789
target:
resource_pool_id: resgroup-1001
state: filter
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 When Returned: When state is present, or when state is set to a supported action Sample: |
|
The full API response body returned by the vCenter OVF library item operation. When When When Returned: On success Sample: |