vmware.vmware.import_content_library_ovf module – Import an OVF or OVA file to a content library from a remote source.

Note

This module is part of the vmware.vmware collection (version 1.11.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.

To use it in a playbook, specify: vmware.vmware.import_content_library_ovf.

Synopsis

  • Import an OVF or OVA library item from a remote source, such as a file on the Ansible host or a URL.

  • Source files should be OVAs or directories matching the OVF standard. OVF directories should contain an .ovf file and at least on .vmdk file.

  • This module manages the content library item, not the remote OVF/OVA. If state is absent, only the content library item will be affected.

Parameters

Parameter

Comments

checksum

string

The checksum that should be used to validate the upload.

checksum_algorithm is required if this is provided.

This is not used if the source is an OVF. In that case he local file size is used to validate the upload.

checksum_algorithm

string

The checksum algorithm to use when validating uploads.

This is required if checksum is provided.

This is not used if the source is an OVF. In that case he local file size is used to validate the upload.

Choices:

  • "SHA1"

  • "MD5"

  • "SHA512"

  • "SHA256"

description

string

A description for the OVF item in the content library.

dest

aliases: name

string / required

The destination name of the OVF item in the content library.

If an item with the same name already exists, the module will not update it.

fail_on_warnings

boolean

Cause the module to treat any warnings thrown during the file upload process as errors.

Choices:

  • false ← (default)

  • true

hostname

string

The hostname or IP address of the vSphere vCenter server.

If the value is not specified in the task, the value of environment variable VMWARE_HOST will be used instead.

library_id

string

The ID of the library to search within.

One of library_id or library_name must be provided.

library_name

string

The name of the library to search within.

One of library_id or library_name must be provided.

password

aliases: pass, pwd

string

The password of the vSphere vCenter server.

If the value is not specified in the task, the value of environment variable VMWARE_PASSWORD will be used instead.

port

integer

The port number of the vSphere vCenter server.

If the value is not specified in the task, the value of environment variable VMWARE_PORT will be used instead.

Default: 443

proxy_host

string

The 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 VMWARE_PROXY_HOST will be used instead.

proxy_port

integer

The 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 VMWARE_PROXY_PORT will be used instead.

proxy_protocol

aliases: protocol

string

The proxy connection protocol to use.

This option is used if the correct proxy protocol cannot be automatically determined.

Choices:

  • "http"

  • "https" ← (default)

src

aliases: url, path

path

The source OVF or OVA file that should be imported to the content library. This can be a local path or a URL.

If it is a local path, it should be a valid path on the Ansible host.

If it is a URL, its scheme can be HTTPS, HTTP, or datastore (ds://). The file is acquired directly from the vCenter appliance.

The module will not encode URLs for you. If this is a URL with special characters (like $ or ~), you should use the urlencode filter.

Required when state is present.

ssl_thumbprint

string

The SSL thumbprint of the source URL, if it uses HTTPS. This is ignored for other schemes.

If this is not provided, whatever certificate is presented will be trusted.

state

string

Controls if the OVF file should be present or absent in the content library.

Choices:

  • "present" ← (default)

  • "absent"

timeout

integer

The timeout period in seconds for uploads to complete.

Default: 300

username

aliases: admin, user

string

The username of the vSphere vCenter server.

If the value is not specified in the task, the value of environment variable VMWARE_USER will be used instead.

validate_certs

boolean

Allows connection when SSL certificates are not valid. Set to false when certificates are not trusted.

If the value is not specified in the task, the value of environment variable VMWARE_VALIDATE_CERTS will be used instead.

Choices:

  • false

  • true ← (default)

Attributes

Attribute

Support

Description

check_mode

Support: full

The check_mode support.

Notes

Note

  • All modules require API write access and hence are not supported on a free ESXi license.

  • All variables and VMware object names are case sensitive.

  • Modules may rely on the ‘requests’ python library, which does not use the system certificate store by default. You can specify the certificate store by setting the REQUESTS_CA_BUNDLE environment variable. Example: ‘export REQUESTS_CA_BUNDLE=/path/to/your/ca_bundle.pem’

See Also

See also

vmware.vmware.deploy_content_library_ovf

Deploy a virtual machine from an OVF in a content library.

Examples

- name: Acquire An OVA From A Url
  vmware.vmware.import_content_library_ovf:
    hostname: "https://vcenter"
    username: "username"
    password: "password"
    src: "https://example.com/my/ova/file.ova"
    dest: my_ova_file
    library_name: MyContentLibrary

- name: Acquire An OVA From A Url With Special Chars
  vmware.vmware.import_content_library_ovf:
    hostname: "https://vcenter"
    username: "username"
    password: "password"
    src: "{{ 'https://example.com/$my$/ova/file.ova' | urlencode }}"
    dest: my_ova_file
    library_name: MyContentLibrary

- name: Upload an OVF From The Ansible Host
  vmware.vmware.import_content_library_ovf:
    hostname: "https://vcenter"
    username: "username"
    password: "password"
    library_id: "{{ my_library.id }}"
    src: /opt/ovfs/my_ovf
    dest: my_ovf_file

- name: Delete an OVF
  vmware.vmware.import_content_library_ovf:
    hostname: "https://vcenter"
    username: "username"
    password: "password"
    state: absent
    library_id: "{{ my_library.id }}"
    dest: my_ovf_file

Authors

  • Ansible Cloud Team (@ansible-collections)