community.vmware.vmware_deploy_ovf – Deploys a VMware virtual machine from an OVF or OVA file

From Get docs
Ansible/docs/2.10/collections/community/vmware/vmware deploy ovf module


community.vmware.vmware_deploy_ovf – Deploys a VMware virtual machine from an OVF or OVA file

Note

This plugin is part of the community.vmware collection (version 1.6.0).

To install it use: ansible-galaxy collection install community.vmware.

To use it in a playbook, specify: community.vmware.vmware_deploy_ovf.


Synopsis

  • This module can be used to deploy a VMware VM from an OVF or OVA file

Requirements

The below requirements are needed on the host that executes this module.

  • pyvmomi

Parameters

Parameter Choices/Defaults Comments

allow_duplicates

boolean

  • no
  • yes

Default:

"True"

Whether or not to allow duplicate VM names. ESXi allows duplicates, vCenter may not.

cluster

string

Cluster to deploy to.

datacenter

string

Default:

"ha-datacenter"

Datacenter to deploy to.

datastore

string

Default:

"datastore1"

Datastore to deploy to.

deployment_option

string

The key of the chosen deployment option.

disk_provisioning

string

  • flat
  • eagerZeroedThick
  • monolithicSparse
  • twoGbMaxExtentSparse
  • twoGbMaxExtentFlat
  • thin

  • sparse
  • thick
  • seSparse
  • monolithicFlat

Disk provisioning type.

fail_on_spec_warnings

boolean

  • no

  • yes

Cause the module to treat OVF Import Spec warnings as errors.

folder

string

Absolute path of folder to place the virtual machine.

If not specified, defaults to the value of datacenter.vmFolder.

Examples:

folder: /ha-datacenter/vm

folder: ha-datacenter/vm

folder: /datacenter1/vm

folder: datacenter1/vm

folder: /datacenter1/vm/folder1

folder: datacenter1/vm/folder1

folder: /folder1/datacenter1/vm

folder: folder1/datacenter1/vm

folder: /folder1/datacenter1/vm/folder2

hostname

string

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

Environment variable support added in Ansible 2.6.

inject_ovf_env

boolean

  • no

  • yes

Force the given properties to be inserted into an OVF Environment and injected through VMware Tools.

name

string

Name of the VM to work with.

Virtual machine names in vCenter are not necessarily unique, which may be problematic.

networks

dictionary

Default:

{"VM Network": "VM Network"}

key: value mapping of OVF network name, to the vCenter network name.

ovf

path

Path to OVF or OVA file to deploy.


aliases: ova

password

string

The password of the vSphere vCenter or ESXi server.

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

Environment variable support added in Ansible 2.6.


aliases: pass, pwd

port

integer

Default:

443

The port number of the vSphere vCenter or ESXi server.

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

Environment variable support added in Ansible 2.6.

power_on

boolean

  • no
  • yes

Whether or not to power on the virtual machine after creation.

properties

dictionary

The assignment of values to the properties found in the OVF as key value pairs.

proxy_host

string

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.

This feature depends on a version of pyvmomi greater than v6.7.1.2018.12

proxy_port

integer

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.

resource_pool

string

Default:

"Resources"

Resource Pool to deploy to.

username

string

The username of the vSphere vCenter or ESXi server.

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

Environment variable support added in Ansible 2.6.


aliases: admin, user

validate_certs

boolean

  • no
  • yes

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.

Environment variable support added in Ansible 2.6.

If set to true, please make sure Python >= 2.7.9 is installed on the given machine.

wait

boolean

  • no
  • yes

Wait for the host to power on.

wait_for_ip_address

boolean

  • no

  • yes

Wait until vCenter detects an IP address for the VM.

This requires vmware-tools (vmtoolsd) to properly work after creation.



Examples

- community.vmware.vmware_deploy_ovf:
    hostname: '{{ vcenter_hostname }}'
    username: '{{ vcenter_username }}'
    password: '{{ vcenter_password }}'
    ovf: /path/to/ubuntu-16.04-amd64.ovf
    wait_for_ip_address: true
  delegate_to: localhost

# Deploys a new VM named 'NewVM' in specific datacenter/cluster, with network mapping taken from variable and using ova template from an absolute path
- community.vmware.vmware_deploy_ovf:
    hostname: '{{ vcenter_hostname }}'
    username: '{{ vcenter_username }}'
    password: '{{ vcenter_password }}'
    datacenter: Datacenter1
    cluster: Cluster1
    datastore: vsandatastore
    name: NewVM
    networks: "{u'VM Network':u'{{ ProvisioningNetworkLabel }}'}"
    power_on: no
    ovf: /absolute/path/to/template/mytemplate.ova
  delegate_to: localhost

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description

instance

dictionary

always

metadata about the new virtual machine


Sample:

None




Authors

  • Matt Martz (@sivel)

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/community/vmware/vmware_deploy_ovf_module.html