d5b04aa1f1
* cloudstack: test: cs_network_acl: add check_mode tests * cloudstack: test: cs_pod: add check_mode tests * cloudstack: test: cs_user: add check_mode tests * cloudstack: test: cs_sshkeypair: add check_mode tests * cloudstack: test: cs_project: add check_mode tests * cloudstack: test: cs_vpc: add check_mode tests * cloudstack: test: cs_vpn_gateway: add check_mode tests * cloudstack: test: cs_volume: add check_mode tests * cloudstack: test: cs_vmsnapshot: add check_mode tests * cloudstack: test: cs_account: add check_mode tests * cloudstack: test: cs_affinitygroup: add check_mode tests * cloudstack: test: cs_cluster: add check_mode tests * cloudstack: test: cs_domain: add check_mode tests * cloudstack: test: cs_instancegroup: add check_mode tests * cloudstack: test: cs_iso: add check_mode tests * cloudstack: test: cs_loadbalancer_rule: add check_mode tests * cloudstack: test: cs_portforward: add check_mode tests * cloudstack: test: cs_resourcelimit: add check_mode tests * cloudstack: test: cs_securitygroup: add check_mode tests * cloudstack: test: cs_securitygroup_rule: add check_mode tests * cloudstack: test: cs_configuration: add check_mode tests * cloudstack: test: cs_firewall: add check_mode tests * cloudstack: test: cs_instance: add check_mode tests * cloudstack: query current tags from API Fixes unexpected tags returned in check mode.
139 lines
3.5 KiB
YAML
139 lines
3.5 KiB
YAML
---
|
|
- name: setup instance
|
|
cs_instance:
|
|
name: "{{ cs_resource_prefix }}-vm-snapshot"
|
|
template: "{{ test_cs_instance_template }}"
|
|
service_offering: "{{ test_cs_instance_offering_1 }}"
|
|
register: instance
|
|
- name: verify create instance
|
|
assert:
|
|
that:
|
|
- instance|success
|
|
|
|
- name: ensure no snapshot exists
|
|
cs_vmsnapshot:
|
|
name: "{{ cs_resource_prefix }}_snapshot"
|
|
vm: "{{ cs_resource_prefix }}-vm-snapshot"
|
|
state: absent
|
|
register: snap
|
|
- name: verify setup
|
|
assert:
|
|
that:
|
|
- snap|success
|
|
|
|
- name: test fail if missing name
|
|
action: cs_vmsnapshot
|
|
register: snap
|
|
ignore_errors: true
|
|
- name: verify results of fail if missing params
|
|
assert:
|
|
that:
|
|
- snap|failed
|
|
- 'snap.msg.startswith("missing required arguments: ")'
|
|
|
|
- name: test create snapshot in check mode
|
|
cs_vmsnapshot:
|
|
name: "{{ cs_resource_prefix }}_snapshot"
|
|
vm: "{{ cs_resource_prefix }}-vm-snapshot"
|
|
snapshot_memory: yes
|
|
register: snap
|
|
check_mode: true
|
|
- name: verify test create snapshot in check mode
|
|
assert:
|
|
that:
|
|
- snap|changed
|
|
|
|
- name: test create snapshot
|
|
cs_vmsnapshot:
|
|
name: "{{ cs_resource_prefix }}_snapshot"
|
|
vm: "{{ cs_resource_prefix }}-vm-snapshot"
|
|
snapshot_memory: yes
|
|
register: snap
|
|
- name: verify test create snapshot
|
|
assert:
|
|
that:
|
|
- snap|changed
|
|
- snap.display_name == "{{ cs_resource_prefix }}_snapshot"
|
|
|
|
- name: test create snapshot idempotence
|
|
cs_vmsnapshot:
|
|
name: "{{ cs_resource_prefix }}_snapshot"
|
|
vm: "{{ cs_resource_prefix }}-vm-snapshot"
|
|
snapshot_memory: yes
|
|
register: snap
|
|
- name: verify test create snapshot idempotence
|
|
assert:
|
|
that:
|
|
- not snap|changed
|
|
- snap.display_name == "{{ cs_resource_prefix }}_snapshot"
|
|
|
|
- name: test revert snapshot in check mode
|
|
cs_vmsnapshot:
|
|
name: "{{ cs_resource_prefix }}_snapshot"
|
|
vm: "{{ cs_resource_prefix }}-vm-snapshot"
|
|
state: revert
|
|
register: snap
|
|
check_mode: true
|
|
- name: verify test revert snapshot in check mode
|
|
assert:
|
|
that:
|
|
- snap|changed
|
|
- snap.display_name == "{{ cs_resource_prefix }}_snapshot"
|
|
|
|
- name: test revert snapshot
|
|
cs_vmsnapshot:
|
|
name: "{{ cs_resource_prefix }}_snapshot"
|
|
vm: "{{ cs_resource_prefix }}-vm-snapshot"
|
|
state: revert
|
|
register: snap
|
|
- name: verify test revert snapshot
|
|
assert:
|
|
that:
|
|
- snap|changed
|
|
- snap.display_name == "{{ cs_resource_prefix }}_snapshot"
|
|
|
|
- name: test remove snapshot in check mode
|
|
cs_vmsnapshot:
|
|
name: "{{ cs_resource_prefix }}_snapshot"
|
|
vm: "{{ cs_resource_prefix }}-vm-snapshot"
|
|
state: absent
|
|
register: snap
|
|
check_mode: true
|
|
- name: verify test remove snapshot in check mode
|
|
assert:
|
|
that:
|
|
- snap|changed
|
|
- snap.display_name == "{{ cs_resource_prefix }}_snapshot"
|
|
|
|
- name: test remove snapshot
|
|
cs_vmsnapshot:
|
|
name: "{{ cs_resource_prefix }}_snapshot"
|
|
vm: "{{ cs_resource_prefix }}-vm-snapshot"
|
|
state: absent
|
|
register: snap
|
|
- name: verify test remove snapshot
|
|
assert:
|
|
that:
|
|
- snap|changed
|
|
- snap.display_name == "{{ cs_resource_prefix }}_snapshot"
|
|
|
|
- name: test remove snapshot idempotence
|
|
cs_vmsnapshot:
|
|
name: "{{ cs_resource_prefix }}_snapshot"
|
|
vm: "{{ cs_resource_prefix }}-vm-snapshot"
|
|
state: absent
|
|
register: snap
|
|
- name: verify test remove snapshot idempotence
|
|
assert:
|
|
that:
|
|
- not snap|changed
|
|
|
|
- name: cleanup instance
|
|
cs_instance:
|
|
name: "{{ cs_resource_prefix }}-vm-snapshot"
|
|
state: expunged
|
|
register: instance
|
|
- name: verify destroy instance
|
|
assert:
|
|
that:
|
|
- instance|success
|