community.vmware.vmware_deploy_ovf (4.2.0) — module

Deploys a VMware virtual machine from an OVF or OVA file, placed on file system or HTTP server

Authors: Alexander Nikitin (@ihumster), Matt Martz (@sivel)

Install collection

Install with ansible-galaxy collection install community.vmware:==4.2.0


Add to requirements.yml

  collections:
    - name: community.vmware
      version: 4.2.0

Description

This module can be used to deploy a VMware VM from an OVF or OVA file, placed on file system or HTTP server

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • 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
- 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: false
    ovf: /absolute/path/to/template/mytemplate.ova
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- community.vmware.vmware_deploy_ovf:
    hostname: '{{ vcenter_hostname }}'
    username: '{{ vcenter_username }}'
    password: '{{ vcenter_password }}'
    datacenter: Datacenter1
    esxi_hostname: test-server
    datastore: test-datastore
    ovf: /path/to/ubuntu-16.04-amd64.ovf
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- community.vmware.vmware_deploy_ovf:
    hostname: '{{ vcenter_hostname }}'
    username: '{{ vcenter_username }}'
    password: '{{ vcenter_password }}'
    url: https://cloud-images.ubuntu.com/releases/xenial/release/ubuntu-16.04-server-cloudimg-amd64.ova
    wait_for_ip_address: true
  delegate_to: localhost

Inputs

    
ovf:
    aliases:
    - ova
    description:
    - Path to OVF or OVA file to deploy.
    - Required if O(url) is not set.
    - O(ovf) and O(url) are mutually exclusive parameters.
    type: path

url:
    description:
    - URL for OVA file to deploy.
    - Required if O(ovf) is not set.
    - O(url) and O(ovf) are mutually exclusive parameters.
    type: str
    version_added: 3.9.0
    version_added_collection: community.vmware

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 E(VMWARE_PORT)
      will be used instead.
    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.
    - This is a required parameter, if O(esxi_hostname) is not set and O(hostname) is
      set to the vCenter server.
    - O(esxi_hostname) and O(cluster) are mutually exclusive parameters.
    - This parameter is case sensitive.
    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 E(VMWARE_HOST)
      will be used instead.
    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 E(VMWARE_PASSWORD)
      will be used instead.
    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 E(VMWARE_USER)
      will be used instead.
    type: str

datastore:
    default: datastore1
    description:
    - Datastore to deploy to.
    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 E(VMWARE_PROXY_HOST)
      will be used instead.
    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 E(VMWARE_PROXY_PORT)
      will be used instead.
    required: false
    type: int

esxi_hostname:
    description:
    - The ESXi hostname where the virtual machine will run.
    - This is a required parameter, if O(cluster) is not set and O(hostname) is set to
      the vCenter server.
    - O(esxi_hostname) and O(cluster) are mutually exclusive parameters.
    - This parameter is case sensitive.
    type: str

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

inject_ovf_env:
    default: false
    description:
    - Force the given properties to be inserted into an OVF Environment and injected through
      VMware Tools.
    type: bool

validate_certs:
    default: true
    description:
    - Allows connection when SSL certificates are not valid. Set to V(false) when certificates
      are not trusted.
    - If the value is not specified in the task, the value of environment variable E(VMWARE_VALIDATE_CERTS)
      will be used instead.
    type: bool

allow_duplicates:
    default: 'True'
    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: false
    description:
    - Cause the module to treat OVF Import Spec warnings as errors.
    type: bool

enable_hidden_properties:
    default: false
    description:
    - Enable source properties that are marked as C(ovf:userConfigurable=false).
    type: bool
    version_added: 3.11.0
    version_added_collection: community.vmware

Outputs

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