community / community.vmware / 4.2.0 / module / vmware_guest_cross_vc_clone Cross-vCenter VM/template clone Authors: Anusha Hegde (@anusha94)community.vmware.vmware_guest_cross_vc_clone (4.2.0) — module
Install with ansible-galaxy collection install community.vmware:==4.2.0
collections: - name: community.vmware version: 4.2.0
This module can be used for Cross-vCenter vm/template clone
# Clone template - name: clone a template across VC community.vmware.vmware_guest_cross_vc_clone: hostname: '{{ vcenter_hostname }}' username: '{{ vcenter_username }}' password: '{{ vcenter_password }}' name: "test_vm1" destination_vm_name: "cloned_vm_from_template" destination_vcenter: '{{ destination_vcenter_hostname }}' destination_vcenter_username: '{{ destination_vcenter_username }}' destination_vcenter_password: '{{ destination_vcenter_password }}' destination_vcenter_port: '{{ destination_vcenter_port }}' destination_vcenter_validate_certs: '{{ destination_vcenter_validate_certs }}' destination_host: '{{ destination_esxi }}' destination_datastore: '{{ destination_datastore }}' destination_vm_folder: '{{ destination_vm_folder }}' state: present register: cross_vc_clone_from_template
- name: clone a VM across VC community.vmware.vmware_guest_cross_vc_clone: hostname: '{{ vcenter_hostname }}' username: '{{ vcenter_username }}' password: "{{ vcenter_password }}" name: "test_vm1" destination_vm_name: "cloned_vm_from_vm" destination_vcenter: '{{ destination_vcenter_hostname }}' destination_vcenter_username: '{{ destination_vcenter_username }}' destination_vcenter_password: '{{ destination_vcenter_password }}' destination_host: '{{ destination_esxi }}' destination_datastore: '{{ destination_datastore }}' destination_vm_folder: '{{ destination_vm_folder }}' state: poweredon register: cross_vc_clone_from_vm
- name: check_mode support community.vmware.vmware_guest_cross_vc_clone: hostname: '{{ vcenter_hostname }}' username: '{{ vcenter_username }}' password: "{{ vcenter_password }}" name: "test_vm1" destination_vm_name: "cloned_vm_from_vm" destination_vcenter: '{{ destination_vcenter_hostname }}' destination_vcenter_username: '{{ destination_vcenter_username }}' destination_vcenter_password: '{{ destination_vcenter_password }}' destination_host: '{{ destination_esxi }}' destination_datastore: '{{ destination_datastore }}' destination_vm_folder: '{{ destination_vm_folder }}' check_mode: true
moid: description: - Managed Object ID of the vm/template instance to manage if known, this is a unique identifier only within a single vCenter instance. - This is required if O(name) or O(uuid) is not supplied. type: str name: description: - Name of the virtual machine or template. - This is a required parameter, if parameter O(uuid) or O(moid) is not supplied. 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 uuid: description: - UUID of the vm/template instance to clone from, this is VMware's unique identifier. - This is a required parameter, if parameter O(name) or O(moid) is not supplied. type: str state: choices: - present - poweredon default: present description: - The state of Virtual Machine deployed. - If set to V(present) and VM does not exists, then VM is created. - If set to V(present) and VM exists, no action is taken. - If set to V(poweredon) and VM does not exists, then VM is created with powered on state. - If set to V(poweredon) and VM exists, no action is taken. required: false type: str timeout: default: 3600 description: - The timeout in seconds. When the timeout is reached, the module will fail. type: int version_added: 3.5.0 version_added_collection: community.vmware 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 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 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 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 is_template: default: false description: - Specifies whether or not the new virtual machine should be marked as a template. 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 destination_host: description: - The name of the destination host. required: true type: str use_instance_uuid: default: false description: - Whether to use the VMware instance UUID rather than the BIOS UUID. type: bool destination_vcenter: description: - The hostname or IP address of the destination VCenter. required: true type: str destination_vm_name: description: - The name of the cloned VM. required: true type: str destination_datastore: description: - The name of the destination datastore or the datastore cluster. - If datastore cluster name is specified, we will find the Storage DRS recommended datastore in that cluster. required: true type: str destination_vm_folder: description: - Destination folder, absolute path to deploy the cloned vm. - This parameter is case sensitive. - 'Examples:' - ' folder: vm' - ' folder: ha-datacenter/vm' - ' folder: /datacenter1/vm' required: true type: str destination_vcenter_port: default: 443 description: - The port to establish connection in the destination VCenter. type: int destination_resource_pool: description: - Destination resource pool. - If not provided, the destination host's parent's resource pool will be used. type: str destination_vcenter_password: description: - The password of the destination VCenter. required: true type: str destination_vcenter_username: description: - The username of the destination VCenter. required: true type: str destination_vcenter_validate_certs: default: false description: - Parameter to indicate if certification validation needs to be done on destination VCenter. type: bool
vm_info: description: metadata about the virtual machine returned: always sample: datastore: '' host: '' power_on: '' vcenter: '' vm_folder: '' vm_name: '' type: dict