Debian Codegraph @

ansible_collections/community/general/tests/integration/targets/scaleway_function/tasks/main.yml

raw
1 ---
2 ####################################################################
3 # WARNING: These are designed specifically for Ansible tests #
4 # and should not be used as examples of how to write Ansible roles #
5 ####################################################################
6
7 # Copyright (c) 2022, Guillaume MARTINEZ <[email protected]>
8 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
9 # SPDX-License-Identifier: GPL-3.0-or-later
10
11 - name: Create function_namespace
12 community.general.scaleway_function_namespace:
13 state: present
14 name: '{{ function_namespace_name }}'
15 region: '{{ scaleway_region }}'
16 project_id: '{{ scw_project }}'
17 description: '{{ description }}'
18 register: integration_function_namespace
19
20 - name: Create a function (Check)
21 check_mode: true
22 community.general.scaleway_function:
23 state: present
24 name: '{{ name }}'
25 region: '{{ scaleway_region }}'
26 namespace_id: '{{ integration_function_namespace.function_namespace.id }}'
27 runtime: '{{ runtime }}'
28 description: '{{ description }}'
29 environment_variables: '{{ environment_variables }}'
30 secret_environment_variables: '{{ secret_environment_variables }}'
31 register: fn_creation_check_task
32
33 - ansible.builtin.debug:
34 var: fn_creation_check_task
35
36 - name: Check module call result
37 ansible.builtin.assert:
38 that:
39 - fn_creation_check_task is success
40 - fn_creation_check_task is changed
41
42 - name: Create function
43 community.general.scaleway_function:
44 state: present
45 name: '{{ name }}'
46 region: '{{ scaleway_region }}'
47 namespace_id: '{{ integration_function_namespace.function_namespace.id }}'
48 runtime: '{{ runtime }}'
49 description: '{{ description }}'
50 environment_variables: '{{ environment_variables }}'
51 secret_environment_variables: '{{ secret_environment_variables }}'
52 register: fn_creation_task
53
54 - ansible.builtin.debug:
55 var: fn_creation_task
56
57 - name: Check module call result
58 ansible.builtin.assert:
59 that:
60 - fn_creation_task is success
61 - fn_creation_task is changed
62 - fn_creation_task.function.status in ["created", "ready"]
63
64 - name: Create function (Confirmation)
65 community.general.scaleway_function:
66 state: present
67 name: '{{ name }}'
68 region: '{{ scaleway_region }}'
69 namespace_id: '{{ integration_function_namespace.function_namespace.id }}'
70 runtime: '{{ runtime }}'
71 description: '{{ description }}'
72 environment_variables: '{{ environment_variables }}'
73 secret_environment_variables: '{{ secret_environment_variables }}'
74 register: fn_creation_confirmation_task
75
76 - ansible.builtin.debug:
77 var: fn_creation_confirmation_task
78
79 - name: Check module call result
80 ansible.builtin.assert:
81 that:
82 - fn_creation_confirmation_task is success
83 - fn_creation_confirmation_task is not changed
84 - fn_creation_confirmation_task.function.status in ["created", "ready"]
85
86 - name: Update function (Check)
87 check_mode: true
88 community.general.scaleway_function:
89 state: present
90 name: '{{ name }}'
91 region: '{{ scaleway_region }}'
92 namespace_id: '{{ integration_function_namespace.function_namespace.id }}'
93 runtime: '{{ runtime }}'
94 description: '{{ updated_description }}'
95 environment_variables: '{{ environment_variables }}'
96 secret_environment_variables: '{{ secret_environment_variables }}'
97 register: fn_update_check_task
98
99 - ansible.builtin.debug:
100 var: fn_update_check_task
101
102 - name: Check module call result
103 ansible.builtin.assert:
104 that:
105 - fn_update_check_task is success
106 - fn_update_check_task is changed
107
108 - name: Update function
109 community.general.scaleway_function:
110 state: present
111 name: '{{ name }}'
112 region: '{{ scaleway_region }}'
113 namespace_id: '{{ integration_function_namespace.function_namespace.id }}'
114 runtime: '{{ runtime }}'
115 description: '{{ updated_description }}'
116 environment_variables: '{{ environment_variables }}'
117 secret_environment_variables: '{{ secret_environment_variables }}'
118 register: fn_update_task
119
120 - ansible.builtin.debug:
121 var: fn_update_task
122
123 - name: Check module call result
124 ansible.builtin.assert:
125 that:
126 - fn_update_task is success
127 - fn_update_task is changed
128 - fn_update_task.function.status in ["created", "ready"]
129
130 - name: Update function (Confirmation)
131 community.general.scaleway_function:
132 state: present
133 name: '{{ name }}'
134 region: '{{ scaleway_region }}'
135 namespace_id: '{{ integration_function_namespace.function_namespace.id }}'
136 runtime: '{{ runtime }}'
137 description: '{{ updated_description }}'
138 environment_variables: '{{ environment_variables }}'
139 secret_environment_variables: '{{ secret_environment_variables }}'
140 register: fn_update_confirmation_task
141
142 - ansible.builtin.debug:
143 var: fn_update_confirmation_task
144
145 - name: Check module call result
146 ansible.builtin.assert:
147 that:
148 - fn_update_confirmation_task is success
149 - fn_update_confirmation_task is not changed
150 - fn_update_confirmation_task.function.status in ["created", "ready"]
151
152 - name: Update function secret variables (Check)
153 check_mode: true
154 community.general.scaleway_function:
155 state: present
156 name: '{{ name }}'
157 region: '{{ scaleway_region }}'
158 namespace_id: '{{ integration_function_namespace.function_namespace.id }}'
159 runtime: '{{ runtime }}'
160 description: '{{ updated_description }}'
161 environment_variables: '{{ environment_variables }}'
162 secret_environment_variables: '{{ updated_secret_environment_variables }}'
163 register: fn_update_secret_check_task
164
165 - ansible.builtin.debug:
166 var: fn_update_secret_check_task
167
168 - name: Check module call result
169 ansible.builtin.assert:
170 that:
171 - fn_update_secret_check_task is success
172 - fn_update_secret_check_task is changed
173
174 - name: Update function secret variables
175 community.general.scaleway_function:
176 state: present
177 name: '{{ name }}'
178 region: '{{ scaleway_region }}'
179 namespace_id: '{{ integration_function_namespace.function_namespace.id }}'
180 runtime: '{{ runtime }}'
181 description: '{{ updated_description }}'
182 environment_variables: '{{ environment_variables }}'
183 secret_environment_variables: '{{ updated_secret_environment_variables }}'
184 register: fn_update_secret_task
185
186 - ansible.builtin.debug:
187 var: fn_update_secret_task
188
189 - name: Check module call result
190 ansible.builtin.assert:
191 that:
192 - fn_update_secret_task is success
193 - fn_update_secret_task is changed
194 - fn_update_secret_task.function.status in ["created", "ready"]
195 - "'hashed_value' in fn_update_secret_task.function.secret_environment_variables[0]"
196
197 - name: Update function secret variables (Confirmation)
198 community.general.scaleway_function:
199 state: present
200 name: '{{ name }}'
201 region: '{{ scaleway_region }}'
202 namespace_id: '{{ integration_function_namespace.function_namespace.id }}'
203 runtime: '{{ runtime }}'
204 description: '{{ updated_description }}'
205 environment_variables: '{{ environment_variables }}'
206 secret_environment_variables: '{{ updated_secret_environment_variables }}'
207 register: fn_update_secret_confirmation_task
208
209 - ansible.builtin.debug:
210 var: fn_update_secret_confirmation_task
211
212 - name: Check module call result
213 ansible.builtin.assert:
214 that:
215 - fn_update_secret_confirmation_task is success
216 - fn_update_secret_confirmation_task is not changed
217 - fn_update_secret_confirmation_task.function.status in ["created", "ready"]
218 - "'hashed_value' in fn_update_secret_confirmation_task.function.secret_environment_variables[0]"
219
220 - name: Delete function (Check)
221 check_mode: true
222 community.general.scaleway_function:
223 state: absent
224 name: '{{ name }}'
225 region: '{{ scaleway_region }}'
226 description: '{{ description }}'
227 namespace_id: '{{ integration_function_namespace.function_namespace.id }}'
228 runtime: '{{ runtime }}'
229 register: fn_deletion_check_task
230
231 - ansible.builtin.debug:
232 var: fn_deletion_check_task
233
234 - name: Check module call result
235 ansible.builtin.assert:
236 that:
237 - fn_deletion_check_task is success
238 - fn_deletion_check_task is changed
239
240 - name: Delete function
241 community.general.scaleway_function:
242 state: absent
243 name: '{{ name }}'
244 region: '{{ scaleway_region }}'
245 description: '{{ description }}'
246 namespace_id: '{{ integration_function_namespace.function_namespace.id }}'
247 runtime: '{{ runtime }}'
248 register: fn_deletion_task
249
250 - ansible.builtin.debug:
251 var: fn_deletion_task
252
253 - name: Check module call result
254 ansible.builtin.assert:
255 that:
256 - fn_deletion_task is success
257 - fn_deletion_task is changed
258
259 - name: Delete function (Confirmation)
260 community.general.scaleway_function:
261 state: absent
262 name: '{{ name }}'
263 region: '{{ scaleway_region }}'
264 description: '{{ description }}'
265 namespace_id: '{{ integration_function_namespace.function_namespace.id }}'
266 runtime: '{{ runtime }}'
267 register: fn_deletion_confirmation_task
268
269 - ansible.builtin.debug:
270 var: fn_deletion_confirmation_task
271
272 - name: Check module call result
273 ansible.builtin.assert:
274 that:
275 - fn_deletion_confirmation_task is success
276 - fn_deletion_confirmation_task is not changed
277
278 - name: Delete function namespace
279 community.general.scaleway_function_namespace:
280 state: absent
281 name: '{{ function_namespace_name }}'
282 region: '{{ scaleway_region }}'
283 description: '{{ description }}'
284 project_id: '{{ scw_project }}'