-
Notifications
You must be signed in to change notification settings - Fork 42
/
vm_operations.yml
52 lines (49 loc) · 1.27 KB
/
vm_operations.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
###### VM OPERATIONS ########
---
- name: VM operations playbook
hosts: localhost
gather_facts: false
collections:
- nutanix.ncp
module_defaults:
group/nutanix.ncp.ntnx:
nutanix_host: <pc_ip>
nutanix_username: <user>
nutanix_password: <pass>
validate_certs: false
tasks:
- name: Setting Variables
set_fact:
script_path: ""
subnet_name: ""
vm_uuid: ""
- name: hard power off the vm
ntnx_vms:
state: present
vm_uuid: "{{ vm_uuid }}"
operation: hard_poweroff
register: result
ignore_errors: true
- name: create_ova_image while vm is on
ntnx_vms_ova:
state: present
src_vm_uuid: "{{ vm_uuid }}"
name: integration_test_VMDK_ova
file_format: VMDK
wait: true
register: result
ignore_errors: true
- name: clone vm while it's off also add network and script
ntnx_vms_clone:
state: present
src_vm_uuid: "{{ vm_uuid }}"
networks:
- is_connected: true
subnet:
name: "{{ subnet_name }}"
guest_customization:
type: "cloud_init"
script_path: "{{ script_path }}"
is_overridable: True
register: result
ignore_errors: true