vmware.vmware.import_content_library_iso module – Import an ISO file to a content library from a remote source.

Note

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

Synopsis

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

  • This module manages the content library item, not the remote ISO. 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 ISO. 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 ISO. In that case he local file size is used to validate the upload.

Choices:

  • "SHA1"

  • "MD5"

  • "SHA512"

  • "SHA256"

description

string

A description for the ISO item in the content library.

dest

aliases: name

string / required

The destination name of the ISO 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 ISO 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 ISO 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. Note having this variable set may cause a ‘false’ value for the ‘validate_certs’ option to be ignored in some cases. Example: ‘export REQUESTS_CA_BUNDLE=/path/to/your/ca_bundle.pem’

Examples

- name: Acquire An ISO From A Url
  vmware.vmware.import_content_library_iso:
    hostname: "https://vcenter"
    username: "username"
    password: "password"
    src: "https://example.com/my/iso/file.iso"
    dest: my_iso_file
    library_name: MyContentLibrary

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

- name: Upload an ISO From The Ansible Host
  vmware.vmware.import_content_library_iso:
    hostname: "https://vcenter"
    username: "username"
    password: "password"
    library_id: "{{ my_library.id }}"
    src: /opt/isos/my_iso.iso
    dest: my_iso_file

- name: Delete an ISO
  vmware.vmware.import_content_library_iso:
    hostname: "https://vcenter"
    username: "username"
    password: "password"
    state: absent
    library_id: "{{ my_library.id }}"
    dest: my_iso_file

Authors

  • Ansible Cloud Team (@ansible-collections)