Note
This plugin is part of the community.vmware collection (version 1.15.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 community.vmware
.
To use it in a playbook, specify: community.vmware.vmware_guest_instant_clone
.
New in version 1.9.0: of community.vmware
Parameter | Choices/Defaults | Comments | |
---|---|---|---|
datacenter string / required | Name of the datacenter, where VM to be deployed. | ||
datastore string / required | The name of the datastore or the datastore cluster. If datastore cluster name is specified, module will find the Storage DRS recommended datastore in that cluster. | ||
folder string | Destination folder, absolute path to deploy the cloned vm. This parameter is case sensitive. Examples: folder: ha-datacenter/vm folder: /datacenter1/vm | ||
guestinfo_vars list / elements=dictionary added in 1.11.0 of community.vmware | Provides GuestOS Customization functionality in instant cloned VM. A list of key value pairs that will be passed to the destination VM. These pairs should be used to provide user-defined customization to differentiate the destination VM from the source VM. | ||
dns string | dns is used to set the dns in Instant Cloned Guest Operating System.. | ||
domain string | domain is used to set A fully qualified domain name (FQDN) or complete domain name for Instant Cloned Guest operating System. | ||
gateway string | netmask is used to set the netmask in Instant Cloned Guest Operating System. | ||
hostname string | hostname is used to obtain the DNS(Domain Name System) name and set the Guest system's hostname. | ||
ipaddress string | ipaddress is used to set the ipaddress in Instant Cloned Guest Operating System. | ||
netmask string | netmask is used to set the netmask in Instant Cloned Guest Operating System. | ||
host string / required | Name of the ESX Host in datacenter in which to place cloned VM. The host has to be a member of the cluster that contains the resource pool. Required with resource_pool to find resource pool details. This will be used as additional information when there are resource pools with same name. aliases: esxi_hostname | ||
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. | ||
moid string | Managed Object ID of the vm instance to manage if known, this is a unique identifier only within a single vCenter instance. This is required if parent_vm or uuid is not supplied. | ||
name string / required | Name of the Cloned virtual machine. aliases: vm_name | ||
parent_vm string | Name of the parent virtual machine. This is a required parameter, if parameter uuid or moid is not supplied. | ||
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. | |
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 | Name of the resource pool in datacenter in which to place deployed VM. Required if cluster is not specified. For default or non-unique resource pool names, specify host and cluster. Resources is the default name of resource pool. | ||
use_instance_uuid boolean |
| Whether to use the VMware instance UUID rather than the BIOS UUID. | |
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 | ||
uuid string | UUID of the vm instance to clone from, this is VMware's unique identifier. This is a required parameter, if parameter parent_vm or moid is not supplied. | ||
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.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. | |
vm_password string | The password used to login-in to the virtual machine. Only required when using guest customization feature. | ||
vm_username string | The user to login-in to the virtual machine. Only required when using guest customization feature. | ||
wait_vm_tools boolean added in 1.12.0 of community.vmware |
| Whether waiting until vm tools start after rebooting an instant clone vm. | |
wait_vm_tools_timeout integer added in 1.12.0 of community.vmware | Default: 300 | Define a timeout (in seconds) for the wait_vm_tools parameter. |
Note
- name: Instant Clone a VM community.vmware.vmware_guest_instant_clone: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" validate_certs: False folder: "{{ f0 }}" datastore: "{{ rw_datastore }}" datacenter: "{{ dc1 }}" host: "{{ esxi1 }}" name: "{{ Clone_vm }}" parent_vm: "{{ testvm_1 }}" resource_pool: "{{ test_resource_001 }}" register: vm_clone delegate_to: localhost - name: set state to poweroff the Cloned VM community.vmware.vmware_guest_powerstate: validate_certs: false hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" name: "cloned_vm_from_vm_cluster" folder: "{{ f0 }}" state: powered-off register: poweroff_instant_clone_from_vm_when_cluster delegate_to: localhost - name: Clean VM community.vmware.vmware_guest: validate_certs: false hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" name: "cloned_vm_from_vm_cluster" datacenter: "{{ dc1 }}" state: absent register: delete_instant_clone_from_vm_when_cluster ignore_errors: true delegate_to: localhost - name: Instant Clone a VM with guest_customization community.vmware.vmware_guest_instant_clone: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" vm_username: "root" vm_password: "SuperSecret" validate_certs: False folder: "{{ f0 }}" datastore: "{{ rw_datastore }}" datacenter: "{{ dc1 }}" host: "{{ esxi1 }}" guestinfo_vars: - hostname: "{{ guestinfo.ic.hostname }}" ipaddress: "{{ guestinfo.ic.ipaddress }}" netmask: "{{ guestinfo.ic.netmask }}" gateway: "{{ guestinfo.ic.gateway }}" dns: "{{ guestinfo.ic.dns }}" domain: "{{ guestinfo.ic.domain }}" name: "Instant_clone_guest_customize" parent_vm: "test_vm1" resource_pool: DC0_C0_RP1 register: Instant_cloned_guest_customize delegate_to: localhost - name: Instant Clone a VM when skipping optional params community.vmware.vmware_guest_instant_clone: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" validate_certs: False name: "{{ Clone_vm }}" parent_vm: "{{ testvm_1 }}" datacenter: "{{ dc1 }}" datastore: "{{ rw_datastore }}" host: "{{ esxi1 }}" register: VM_clone_optional_arguments delegate_to: localhost - name: Instant clone in check mode community.vmware.vmware_guest_instant_clone: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" validate_certs: False folder: "{{ f0 }}" datastore: "{{ rw_datastore }}" datacenter: "{{ dc1 }}" host: "{{ esx1 }}" name: "{{ Clone_vm }}" parent_vm: "{{ testvm_2 }}" resource_pool: "{{ test_resource_001 }}" check_mode: true register: check_mode_clone delegate_to: localhost - debug: var: check_mode_clone
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
vm_info dictionary | always | metadata about the virtual machine added instance_uuid from version 1.12.0 Sample: {'datastore': '', 'host': '', 'instance_uuid': '', 'vcenter': '', 'vm_folder': '', 'vm_name': ''} |
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/vmware/vmware_guest_instant_clone_module.html