|
|
|
@ -134,47 +134,48 @@
|
|
|
|
|
- "guest_facts_0003['instance']['snapshots']|length == 0"
|
|
|
|
|
- "guest_facts_0003['instance']['current_snapshot'] is none"
|
|
|
|
|
|
|
|
|
|
# Commenting as this is failing right now - 15 Dec 2017
|
|
|
|
|
# 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'"
|
|
|
|
|
- "guest_facts_0002['instance']['hw_folder'] == vm1 | dirname"
|
|
|
|
|
#- 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'"
|
|
|
|
|
# - "guest_facts_0002['instance']['hw_folder'] == vm1 | dirname"
|
|
|
|
|