Solved

How to provide guest credentials when creating Move plan through API

  • 2 March 2023
  • 1 reply
  • 82 views

I am able to create a Move plan using the API and Ansible for migrating a VM from vSphere to Nutanix. However, I am unable to specify the guest credentials for the guest operations (like removing VMware Tools from the replicated vm during the migration) in the actual rest call (see code below) as is possible using the GUI. I cannot find any way in the API documentation on how to get the credentials into the request. Hope somebody can assist.

- name: "Create Move Plan: Task 1.2a - Create Move Plan for OTA"
uri:
url: "https://{{ move_server_ota }}/move/{{ mapi_version }}/plans"
method: POST
validate_certs: no
force_basic_auth: yes
headers:
Authorization: "{{ move_token_ota }}"
body_format: json
body: |
{
"Spec": {
"Name": "{{ move_host_name | lower }}",
"NetworkMappings": [
{
"SourceNetworkID": "{{ move_source_network_id[0] }}",
"TargetNetworkID": "{{ move_ota_target_network_uuid}}",
"TestNetworkID": "{{ move_ota_test_network_uuid }}"
},
{
"SourceNetworkID": "{{ move_source_network_id[1] }}",
"TargetNetworkID": "{{ move_ota_target_network_uuid }}",
"TestNetworkID": "{{ move_ota_test_network_uuid }}"
}
],
"Settings": {
"GuestPrepMode": "Automatic",
"SkipIPRetentionUI": false,
"SkipUninstallGuestToolsUI": false
},
"SourceInfo": {
"ProviderUUID": "{{ move_ota_source_provider_uuid }}"
},
"TargetInfo": {
"AOSProviderAttrs": {
"ClusterUUID": "{{ move_ota_target_cluster_uuid }}",
"ContainerUUID": "{{ move_ota_target_container_uuid }}"
},
"ProviderUUID": "{{ move_ota_target_provider_uuid }}"
},
"Workload": {
"Type": "VM",
"VMs": [
{
"VMReference": {
"UUID": "{{ move_vm_uuid }}",
"VMID": "{{ move_vm_id }}"
}
}
]
}
}
}
return_content: yes
timeout: 300
register: move_respons

 

icon

Best answer by Mcram 3 March 2023, 08:52

View original

This topic has been closed for comments

1 reply

Never mind. I took another look at the API reference and it seems I had missed the prepare source function that will set/use the required credentials. So back to dev’ing and testing 😊