ansible.builtin.vmware_deploy_ovf (v2.9.24) — module

Deploys a VMware virtual machine from an OVF or OVA file

| "added in version" 2.7 of ansible.builtin"

Authors: Matt Martz (@sivel)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.24

Description

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


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Deploys a new VM named 'NewVM' in specific datacenter/cluster, with network mapping taken from variable and using ova template from an absolute path
- 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 }}'}"
    validate_certs: no
    power_on: no
    ovf: /absolute/path/to/template/mytemplate.ova
  delegate_to: localhost

Inputs

    
ovf:
    aliases:
    - ova
    description:
    - Path to OVF or OVA file to deploy.

name:
    description:
    - Name of the VM to work with.
    - Virtual machine names in vCenter are not necessarily unique, which may be problematic.
    type: str

port:
    default: 443
    description:
    - The port number of the vSphere vCenter or ESXi server.
    - If the value is not specified in the task, the value of environment variable C(VMWARE_PORT)
      will be used instead.
    - Environment variable support added in Ansible 2.6.
    type: int

wait:
    default: true
    description:
    - Wait for the host to power on.
    type: bool

folder:
    description:
    - Absolute path of folder to place the virtual machine.
    - If not specified, defaults to the value of C(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'
    type: str

cluster:
    description:
    - Cluster to deploy to.
    type: str

hostname:
    description:
    - 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 C(VMWARE_HOST)
      will be used instead.
    - Environment variable support added in Ansible 2.6.
    type: str

networks:
    default:
      VM Network: VM Network
    description:
    - 'C(key: value) mapping of OVF network name, to the vCenter network name.'
    type: dict

password:
    aliases:
    - pass
    - pwd
    description:
    - The password of the vSphere vCenter or ESXi server.
    - If the value is not specified in the task, the value of environment variable C(VMWARE_PASSWORD)
      will be used instead.
    - Environment variable support added in Ansible 2.6.
    type: str

power_on:
    default: true
    description:
    - Whether or not to power on the virtual machine after creation.
    type: bool

username:
    aliases:
    - admin
    - user
    description:
    - The username of the vSphere vCenter or ESXi server.
    - If the value is not specified in the task, the value of environment variable C(VMWARE_USER)
      will be used instead.
    - Environment variable support added in Ansible 2.6.
    type: str

datastore:
    default: datastore1
    description:
    - Datastore to deploy to.
    - 'You can also specify datastore storage cluster. version_added: 2.9'
    type: str

datacenter:
    default: ha-datacenter
    description:
    - Datacenter to deploy to.
    type: str

properties:
    description:
    - The assignment of values to the properties found in the OVF as key value pairs.
    type: dict

proxy_host:
    description:
    - 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 C(VMWARE_PROXY_HOST)
      will be used instead.
    - This feature depends on a version of pyvmomi greater than v6.7.1.2018.12
    required: false
    type: str

proxy_port:
    description:
    - 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 C(VMWARE_PROXY_PORT)
      will be used instead.
    required: false
    type: int

resource_pool:
    default: Resources
    description:
    - Resource Pool to deploy to.
    type: str

inject_ovf_env:
    description:
    - Force the given properties to be inserted into an OVF Environment and injected through
      VMware Tools.
    type: bool
    version_added: '2.8'
    version_added_collection: ansible.builtin

validate_certs:
    default: true
    description:
    - Allows connection when SSL certificates are not valid. Set to C(false) when certificates
      are not trusted.
    - If the value is not specified in the task, the value of environment variable C(VMWARE_VALIDATE_CERTS)
      will be used instead.
    - Environment variable support added in Ansible 2.6.
    - If set to C(true), please make sure Python >= 2.7.9 is installed on the given machine.
    type: bool

allow_duplicates:
    default: 'yes'
    description:
    - Whether or not to allow duplicate VM names. ESXi allows duplicates, vCenter may
      not.
    type: bool

deployment_option:
    description:
    - The key of the chosen deployment option.
    type: str

disk_provisioning:
    choices:
    - flat
    - eagerZeroedThick
    - monolithicSparse
    - twoGbMaxExtentSparse
    - twoGbMaxExtentFlat
    - thin
    - sparse
    - thick
    - seSparse
    - monolithicFlat
    default: thin
    description:
    - Disk provisioning type.
    type: str

wait_for_ip_address:
    default: false
    description:
    - Wait until vCenter detects an IP address for the VM.
    - This requires vmware-tools (vmtoolsd) to properly work after creation.
    type: bool

fail_on_spec_warnings:
    default: 'no'
    description:
    - Cause the module to treat OVF Import Spec warnings as errors.
    type: bool

Outputs

instance:
  description: metadata about the new virtual machine
  returned: always
  sample: None
  type: dict