I am trying to perform vmotion of multiple VMs between 2 ESXi hosts using the vmare_vmotion module. We need to set a cap for memory utilization of the destination host to <= 70% and the storage utilization to <= 90%.
Required result: VMs have to be migrated until the memory and storage utilization has reached. The loop should stop VM migration once the memory & storage threshold has reached.
- name: Perform storage vMotion and host vMotion of virtual machine
vmware_vmotion:
hostname: “{{ running_host }}”
username: “{{ esxi_user }}”
password: “{{ esxi_pass }}”
validate_certs: no
vm_name: “{{ item.guest_name }}”
destination_host: “{{ destination_host }}”
destination_datastore: “{{ item.name }}”
delegate_to: localhost
with_nested: - “{{vm_info.virtual_machines}}”
- “{{ansible_datastore}}”
Any inputs is highly appreciated.