Debian Codegraph @

ansible_collections/cloudscale_ch/cloud/tests/integration/targets/volume_snapshot/tasks/tests.yml

raw
1 ---
2 - name: Try delete unexisting volume snapshot
3 cloudscale_ch.cloud.volume_snapshot:
4 uuid: '{{ cloudscale_resource_prefix }}-not-existing'
5 state: 'absent'
6 register: volume_snapshot
7 - name: 'VERIFY: Try delete unexisting volume snapshot'
8 assert:
9 that:
10 - volume_snapshot is not changed
11
12 - name: Create volume snapshot in check mode
13 cloudscale_ch.cloud.volume_snapshot:
14 name: '{{ cloudscale_resource_prefix }}-test-volume-snapshot'
15 source_volume: '{{ test_volume.uuid }}'
16 tags:
17 project: ansible-test
18 stage: production
19 check_mode: yes
20 register: volume_snapshot
21 - name: 'VERIFY: Create volume snapshot in check mode'
22 assert:
23 that:
24 - volume_snapshot is changed
25 - volume_snapshot.state == 'absent'
26
27 - name: Try access volume snapshot created in check mode
28 cloudscale_ch.cloud.volume_snapshot:
29 name: '{{ cloudscale_resource_prefix }}-test-volume-snapshot'
30 register: volume_snapshot
31 ignore_errors: True
32 - name: 'VERIFY: Try access volume snapshot created in check mode'
33 assert:
34 that:
35 - volume_snapshot is failed
36
37 - name: Create volume snapshot
38 cloudscale_ch.cloud.volume_snapshot:
39 name: '{{ cloudscale_resource_prefix }}-test-volume-snapshot'
40 source_volume: '{{ test_volume.uuid }}'
41 tags:
42 project: ansible-test
43 stage: production
44 register: volume_snapshot
45 - name: 'VERIFY: Create volume snapshot'
46 assert:
47 that:
48 - volume_snapshot is changed
49 - volume_snapshot.state == 'present'
50 - volume_snapshot.tags.project == 'ansible-test'
51 - volume_snapshot.tags.stage == 'production'
52
53 - name: Create volume snapshot (idempotency)
54 cloudscale_ch.cloud.volume_snapshot:
55 name: '{{ cloudscale_resource_prefix }}-test-volume-snapshot'
56 source_volume: '{{ test_volume.uuid }}'
57 tags:
58 project: ansible-test
59 stage: production
60 register: volume_snapshot_idempotency
61 - name: 'VERIFY: Create volume snapshot (idempotency)'
62 assert:
63 that:
64 - volume_snapshot_idempotency is not changed
65 - volume_snapshot_idempotency.name == cloudscale_resource_prefix + '-test-volume-snapshot'
66 - volume_snapshot_idempotency.uuid == volume_snapshot.uuid
67
68 - name: Update volume snapshot in check mode
69 cloudscale_ch.cloud.volume_snapshot:
70 uuid: '{{ volume_snapshot.uuid }}'
71 tags:
72 stage: marked-for-deletion
73 register: volume_snapshot
74 check_mode: True
75 - name: 'VERIFY: Update volume snapshot in check mode'
76 assert:
77 that:
78 - volume_snapshot is changed
79 - volume_snapshot.tags.project == 'ansible-test'
80 - volume_snapshot.tags.stage == 'production'
81
82 - name: Update volume snapshot
83 cloudscale_ch.cloud.volume_snapshot:
84 uuid: '{{ volume_snapshot.uuid }}'
85 tags:
86 stage: marked-for-deletion
87 register: volume_snapshot
88 - name: 'VERIFY: Update volume snapshot'
89 assert:
90 that:
91 - volume_snapshot is changed
92 - volume_snapshot.tags.project is undefined
93 - volume_snapshot.tags.stage == 'marked-for-deletion'
94
95 - name: Update volume snapshot (idempotency)
96 cloudscale_ch.cloud.volume_snapshot:
97 uuid: '{{ volume_snapshot.uuid }}'
98 tags:
99 stage: marked-for-deletion
100 register: volume_snapshot
101 check_mode: True
102 - name: 'VERIFY: Update volume snapshot (idempotency)'
103 assert:
104 that:
105 - volume_snapshot is not changed
106 - volume_snapshot.tags.project is undefined
107 - volume_snapshot.tags.stage == 'marked-for-deletion'
108
109 - name: Get updated volume snapshot
110 cloudscale_ch.cloud.volume_snapshot:
111 uuid: '{{ volume_snapshot.uuid }}'
112 register: volume_snapshot
113 - name: 'VERIFY: Update volume snapshot'
114 assert:
115 that:
116 - volume_snapshot.tags.stage == 'marked-for-deletion'
117
118 - name: Delete volume snapshot (check_mode)
119 cloudscale_ch.cloud.volume_snapshot:
120 uuid: '{{ volume_snapshot.uuid }}'
121 state: absent
122 check_mode: True
123 register: volume_snapshot
124 - name: 'VERIFY: Delete volume snapshot (check_mode)'
125 assert:
126 that:
127 - volume_snapshot is changed
128 - volume_snapshot.state == 'present'
129
130 - name: Delete volume snapshot
131 cloudscale_ch.cloud.volume_snapshot:
132 uuid: '{{ volume_snapshot.uuid }}'
133 state: absent
134 register: volume_snapshot
135 - name: 'VERIFY: Delete volume snapshot'
136 assert:
137 that:
138 - volume_snapshot is changed
139 - volume_snapshot.state == 'absent'
140
141 - name: Delete a deleted volume snapshot (idempotency)
142 cloudscale_ch.cloud.volume_snapshot:
143 uuid: '{{ volume_snapshot.uuid }}'
144 state: absent
145 register: volume_snapshot
146 - name: 'VERIFY: Delete volume snapshot'
147 assert:
148 that:
149 - volume_snapshot is not changed
150 - volume_snapshot.state == 'absent'