@ -90,3 +90,65 @@
- "guest_facts_0002['instance']['hw_name'] == vm1 | basename"
- "guest_facts_0002['instance']['hw_name'] == vm1 | basename"
- "guest_facts_0002['instance']['hw_product_uuid'] is defined"
- "guest_facts_0002['instance']['hw_product_uuid'] is defined"
- "guest_facts_0002['instance']['hw_product_uuid'] == vm1_uuid"
- "guest_facts_0002['instance']['hw_product_uuid'] == vm1_uuid"
# Testcase 0003: Get details about virtual machines without snapshots using UUID
- name : get empty list of snapshots from virtual machine using UUID
vmware_guest_facts:
validate_certs : False
hostname : "{{ vcsim }}"
username : "{{ vcsim_instance['json']['username'] }}"
password : "{{ vcsim_instance['json']['password'] }}"
datacenter : "{{ dc1 | basename }}"
uuid : "{{ vm1_uuid }}"
register : guest_facts_0003
- debug : msg="{{ guest_facts_0003 }}"
- assert:
that:
- "guest_facts_0003['instance']['snapshots']|length == 0"
- "guest_facts_0003['instance']['current_snapshot'] is none"
# Testcase 0004: Get details about virtual machines with two snapshots using UUID
- name : Create first snapshot
vmware_guest_snapshot:
validate_certs : False
hostname : "{{ vcsim }}"
username : "{{ vcsim_instance['json']['username'] }}"
password : "{{ vcsim_instance['json']['password'] }}"
datacenter : "{{ dc1 | basename }}"
name : "{{ vm1 | basename }}"
folder : "{{ vm1 | dirname }}"
state : present
snapshot_name : snap1
- name : Create second snapshot
vmware_guest_snapshot:
validate_certs : False
hostname : "{{ vcsim }}"
username : "{{ vcsim_instance['json']['username'] }}"
password : "{{ vcsim_instance['json']['password'] }}"
datacenter : "{{ dc1 | basename }}"
name : "{{ vm1 | basename }}"
folder : "{{ vm1 | dirname }}"
state : present
snapshot_name : snap2
- name : get list of snapshots from virtual machine using UUID
vmware_guest_facts:
validate_certs : False
hostname : "{{ vcsim }}"
username : "{{ vcsim_instance['json']['username'] }}"
password : "{{ vcsim_instance['json']['password'] }}"
datacenter : "{{ dc1 | basename }}"
uuid : "{{ vm1_uuid }}"
register : guest_facts_0004
- debug : msg="{{ guest_facts_0004 }}"
- assert:
that:
- "guest_facts_0004['instance']['snapshots'] is defined"
- "guest_facts_0004['instance']['snapshots'][0]['name'] == 'snap1'"
- "guest_facts_0004['instance']['snapshots'][1]['name'] == 'snap2'"
- "guest_facts_0004['instance']['current_snapshot']['name'] == 'snap2'"