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

Deploy Virtual Machine from template stored in content library.

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

Authors: Pavan Bidkar (@pgbidkar)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.24

Description

Module to deploy virtual machine from template in content library.

Content Library feature is introduced in vSphere 6.0 version, so this module is not supported in the earlier versions of vSphere.

All variables and VMware object names are case sensitive.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Deploy Virtual Machine from template in content library
  vmware_content_deploy_template:
    hostname: '{{ vcenter_hostname }}'
    username: '{{ vcenter_username }}'
    password: '{{ vcenter_password }}'
    template: rhel_test_template
    datastore: Shared_NFS_Volume
    folder: vm
    datacenter: Sample_DC_1
    name: Sample_VM
    resource_pool: test_rp
    validate_certs: False
    state: present
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Deploy Virtual Machine from template in content library with PowerON State
  vmware_content_deploy_template:
    hostname: '{{ vcenter_hostname }}'
    username: '{{ vcenter_username }}'
    password: '{{ vcenter_password }}'
    template: rhel_test_template
    datastore: Shared_NFS_Volume
    folder: vm
    datacenter: Sample_DC_1
    name: Sample_VM
    resource_pool: test_rp
    validate_certs: False
    state: poweredon
  delegate_to: localhost

Inputs

    
host:
    description:
    - Name of the ESX Host in datacenter in which to place deployed VM.
    required: true
    type: str

name:
    aliases:
    - vm_name
    description:
    - The name of the VM to be deployed.
    required: true
    type: str

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

state:
    choices:
    - present
    - poweredon
    default: present
    description:
    - The state of Virtual Machine deployed from template in content library.
    - If set to C(present) and VM does not exists, then VM is created.
    - If set to C(present) and VM exists, no action is taken.
    - If set to C(poweredon) and VM does not exists, then VM is created with powered on
      state.
    - If set to C(poweredon) and VM exists, no action is taken.
    required: false
    type: str

folder:
    description:
    - Name of the folder in datacenter in which to place deployed VM.
    required: true
    type: str

cluster:
    description:
    - Name of the cluster in datacenter in which to place deployed VM.
    required: false
    type: str

hostname:
    description:
    - The hostname or IP address of the vSphere vCenter server.
    - If the value is not specified in the task, the value of environment variable C(VMWARE_HOST)
      will be used instead.
    type: str

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

protocol:
    choices:
    - http
    - https
    default: https
    description:
    - The connection to protocol.
    type: str

template:
    aliases:
    - template_src
    description:
    - The name of template from which VM to be deployed.
    required: true
    type: str

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

datastore:
    description:
    - Name of the datastore to store deployed VM and disk.
    required: true
    type: str

datacenter:
    description:
    - Name of the datacenter, where VM to be deployed.
    required: true
    type: str

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.
    required: false
    type: str
    version_added: 1.12.0
    version_added_collection: community.vmware

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
    version_added: 1.12.0
    version_added_collection: community.vmware

resource_pool:
    description:
    - Name of the resourcepool in datacenter in which to place deployed VM.
    required: false
    type: str

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.
    type: bool

Outputs

vm_deploy_info:
  description: Virtual machine deployment message and vm_id
  returned: on success
  sample:
    msg: Deployed Virtual Machine 'Sample_VM'.
    vm_id: vm-1009
  type: dict