update_ngt.yml 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. ---
  2. # Calls Prism Element (functionality unavailable in Prism Central) to mount
  3. # and enable Nutanix Guest Tools for created VM(s).
  4. - name: Pause to allow Nutanix to create VM(s) before mounting and enabling Nutanix Guest Tools
  5. pause:
  6. seconds: 30
  7. - name: Mount Nutanix Guest Tools
  8. uri:
  9. url: "{{ pe_api_url }}/vms/{{ item }}/guest_tools/mount"
  10. body:
  11. length: 100
  12. offset: 0
  13. filter: ""
  14. method: POST
  15. validate_certs: no
  16. body_format: json
  17. status_code: 200
  18. headers:
  19. Cookie: "{{ pe_session_cookie }}"
  20. register: json_mount_ngt_result
  21. ignore_errors: yes
  22. with_items: "{{ vm_uuids }}"
  23. - name: Debug | Mount NGT
  24. debug:
  25. msg: "Result of mounting NGT : {{ json_mount_ngt_result }}"
  26. when: global_debug|bool
  27. - name: Enable Nutanix Guest Tools
  28. uri:
  29. url: "{{ pe_api_url }}/vms/{{ item }}/guest_tools"
  30. body:
  31. "{{ lookup('template', 'vm-ngt.yml.j2') | from_yaml }}"
  32. method: POST
  33. validate_certs: no
  34. body_format: json
  35. status_code: [200,201,202]
  36. headers:
  37. Cookie: "{{ pe_session_cookie }}"
  38. register: json_enable_ngt_result
  39. ignore_errors: yes
  40. with_items: "{{ vm_uuids }}"
  41. - name: Debug | Enable NGT
  42. debug:
  43. msg: "Enabling NGT : {{ json_enable_ngt_result }}"
  44. when: global_debug|bool