5 Essential Tips for Maximizing Your Experience at Nutanix .NEXT for Bloggers
Regarding multiple clusters, as I only have access to a single node Community Edition cluster, I don’t know… Maybe you can use “GET /vms/”, and loop over your clusters until you find the VM.
Hi Raj it seems Nutanix’s API only returns dates in micro seconds : "json": { "cluster_uuid": "0005cec4-5d52-efbf-2bb0-00505698bc02", "complete_time_usecs": 1636384114684320, "create_time_usecs": 1636384114376874 You can use strfime filter to convert it to human readable format : https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html#handling-dates-and-times - name: Wait till task has ended uri: url: '{{ api_url_v2 }}/tasks/{{ task_uuid }}' method: GET validate_certs: false force_basic_auth: true url_username: "{{ prism_user }}" url_password: "{{ prism_password }}" return_content: true register: task_status delegate_to: localhost retries: 10 delay: 5 until: task_status.json.progress_status == "Succeeded"- name: Display snapshot creation time to human readable format debug: msg: "Snapshot creation time : {{ '%Y-%m-%d %H:%M:%S' | strftime((task_status.json.create_time_usecs|string)[:10]) }}" The result wil
I added to role which removes all the snapshots of a given VM : https://github.com/Fredouye/nutanix_ansible/tree/main/roles/vm_snapshots_remove
Hiusing bash, you have 2 options : ssh to your cvm to run acli commands, or curl/jq to call the REST API. But I’d use Ansible to call the API, if I were you :)
Hiyou can easily use Ansible to delete a VM, using the “DELETE /vms/{{ uuid }}” API call.My Ansible role checks for snapshot completion, if there’s an issue the task will fail.To list snapshots, you can use the “GET /snapshots” API call.When taking a snapshot, you don’t need to specify the cluster, but I guess your Prism has to manage all your hosts. I’m new to Nutanix, please forgive me if I’m wrong :)
HiI added an Ansible role to take snapshots of a VM : https://github.com/Fredouye/nutanix_ansibleThere are also roles to create a VM, and to add disks to an existing VM.
Already have an account? Login
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.
Sorry, we're still checking this file's contents to make sure it's safe to download. Please try again in a few minutes.
Sorry, our virus scanner detected that this file isn't safe to download.