community.vmware.vmware_guest_move – Moves virtual machines in vCenter¶
Note
This plugin is part of the community.vmware collection (version 1.9.0).
To install it use: ansible-galaxy collection install community.vmware
.
To use it in a playbook, specify: community.vmware.vmware_guest_move
.
Requirements¶
The below requirements are needed on the host that executes this module.
python >= 2.6
PyVmomi
Parameters¶
Examples¶
- name: Move Virtual Machine
community.vmware.vmware_guest_move:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: datacenter
name: testvm-1
dest_folder: "/{{ datacenter }}/vm"
delegate_to: localhost
- name: Move Virtual Machine using MoID
community.vmware.vmware_guest_move:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: datacenter
moid: vm-42
dest_folder: "/{{ datacenter }}/vm"
delegate_to: localhost
- name: Get VM UUID
vmware_guest_facts:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter }}"
folder: "/{{ datacenter }}/vm"
name: "{{ vm_name }}"
delegate_to: localhost
register: vm_facts
- name: Get UUID from previous task and pass it to this task
community.vmware.vmware_guest_move:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter }}"
uuid: "{{ vm_facts.instance.hw_product_uuid }}"
dest_folder: "/DataCenter/vm/path/to/new/folder/where/we/want"
delegate_to: localhost
register: facts
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Authors¶
Jose Angel Munoz (@imjoseangel)