Skip to content

Instantly share code, notes, and snippets.

@gowatana
Created December 24, 2018 18:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gowatana/5866e0408c6ea89512eff4c39325e9d6 to your computer and use it in GitHub Desktop.
Save gowatana/5866e0408c6ea89512eff4c39325e9d6 to your computer and use it in GitHub Desktop.
Ansible で Nutanix AHV の VM Snapshot を取得する。Nutanix REST API v2
---
- name: Nutnaix AHV Take VM Snapshot
hosts: localhost
connection: local
vars:
prism_address: "Prism のアドレス"
prism_username: "admin"
prism_password: "Prism ユーザのパスワード"
ahv_vm_uuid: "ff156400-4234-4ddf-8d3f-6ac56b9b7a52"
ahv_vm_snapshot_name: "ansible-snapshot-test-001"
tasks:
- name: Take VM Snapshot {{ ahv_vm_snapshot_name }}
uri:
url: "https://{{ prism_address }}:9440/api/nutanix/v2.0/snapshots/"
method: POST
user: "{{ prism_username }}"
password: "{{ prism_password }}"
body:
snapshot_specs:
- vm_uuid: "{{ ahv_vm_uuid }}"
snapshot_name: "{{ ahv_vm_snapshot_name }}"
body_format: json
headers:
Content-Type: application/json
Accept: application/json
force_basic_auth: yes
validate_certs: no
status_code: 201
@kumaresan078
Copy link

Hi,

Could you help with code for deleting snapshot?

Regards
Mk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment