| 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 a function namespace (Check) |
| 12 |
check_mode: true |
| 13 |
community.general.scaleway_function_namespace: |
| 14 |
state: present |
| 15 |
name: '{{ name }}' |
| 16 |
region: '{{ scaleway_region }}' |
| 17 |
project_id: '{{ scw_project }}' |
| 18 |
description: '{{ description }}' |
| 19 |
environment_variables: '{{ environment_variables }}' |
| 20 |
secret_environment_variables: '{{ secret_environment_variables }}' |
| 21 |
register: fn_creation_check_task |
| 22 |
|
| 23 |
- ansible.builtin.debug: |
| 24 |
var: fn_creation_check_task |
| 25 |
|
| 26 |
- name: Check module call result |
| 27 |
ansible.builtin.assert: |
| 28 |
that: |
| 29 |
- fn_creation_check_task is success |
| 30 |
- fn_creation_check_task is changed |
| 31 |
|
| 32 |
- name: Create function_namespace |
| 33 |
community.general.scaleway_function_namespace: |
| 34 |
state: present |
| 35 |
name: '{{ name }}' |
| 36 |
region: '{{ scaleway_region }}' |
| 37 |
project_id: '{{ scw_project }}' |
| 38 |
description: '{{ description }}' |
| 39 |
environment_variables: '{{ environment_variables }}' |
| 40 |
secret_environment_variables: '{{ secret_environment_variables }}' |
| 41 |
register: fn_creation_task |
| 42 |
|
| 43 |
- ansible.builtin.debug: |
| 44 |
var: fn_creation_task |
| 45 |
|
| 46 |
- name: Check module call result |
| 47 |
ansible.builtin.assert: |
| 48 |
that: |
| 49 |
- fn_creation_task is success |
| 50 |
- fn_creation_task is changed |
| 51 |
- fn_creation_task.function_namespace.status == "ready" |
| 52 |
- "'hashed_value' in fn_creation_task.function_namespace.secret_environment_variables[0]" |
| 53 |
|
| 54 |
- name: Create function namespace (Confirmation) |
| 55 |
community.general.scaleway_function_namespace: |
| 56 |
state: present |
| 57 |
name: '{{ name }}' |
| 58 |
region: '{{ scaleway_region }}' |
| 59 |
project_id: '{{ scw_project }}' |
| 60 |
description: '{{ description }}' |
| 61 |
environment_variables: '{{ environment_variables }}' |
| 62 |
secret_environment_variables: '{{ secret_environment_variables }}' |
| 63 |
register: fn_creation_confirmation_task |
| 64 |
|
| 65 |
- ansible.builtin.debug: |
| 66 |
var: fn_creation_confirmation_task |
| 67 |
|
| 68 |
- name: Check module call result |
| 69 |
ansible.builtin.assert: |
| 70 |
that: |
| 71 |
- fn_creation_confirmation_task is success |
| 72 |
- fn_creation_confirmation_task is not changed |
| 73 |
- fn_creation_confirmation_task.function_namespace.status == "ready" |
| 74 |
- "'hashed_value' in fn_creation_task.function_namespace.secret_environment_variables[0]" |
| 75 |
|
| 76 |
- name: Update function namespace (Check) |
| 77 |
check_mode: true |
| 78 |
community.general.scaleway_function_namespace: |
| 79 |
state: present |
| 80 |
name: '{{ name }}' |
| 81 |
region: '{{ scaleway_region }}' |
| 82 |
project_id: '{{ scw_project }}' |
| 83 |
description: '{{ updated_description }}' |
| 84 |
environment_variables: '{{ environment_variables }}' |
| 85 |
secret_environment_variables: '{{ secret_environment_variables }}' |
| 86 |
register: fn_update_check_task |
| 87 |
|
| 88 |
- ansible.builtin.debug: |
| 89 |
var: fn_update_check_task |
| 90 |
|
| 91 |
- name: Check module call result |
| 92 |
ansible.builtin.assert: |
| 93 |
that: |
| 94 |
- fn_update_check_task is success |
| 95 |
- fn_update_check_task is changed |
| 96 |
|
| 97 |
- name: Update function namespace |
| 98 |
community.general.scaleway_function_namespace: |
| 99 |
state: present |
| 100 |
name: '{{ name }}' |
| 101 |
region: '{{ scaleway_region }}' |
| 102 |
project_id: '{{ scw_project }}' |
| 103 |
description: '{{ updated_description }}' |
| 104 |
environment_variables: '{{ environment_variables }}' |
| 105 |
secret_environment_variables: '{{ secret_environment_variables }}' |
| 106 |
register: fn_update_task |
| 107 |
|
| 108 |
- ansible.builtin.debug: |
| 109 |
var: fn_update_task |
| 110 |
|
| 111 |
- name: Check module call result |
| 112 |
ansible.builtin.assert: |
| 113 |
that: |
| 114 |
- fn_update_task is success |
| 115 |
- fn_update_task is changed |
| 116 |
- fn_update_task.function_namespace.status == "ready" |
| 117 |
- "'hashed_value' in fn_creation_task.function_namespace.secret_environment_variables[0]" |
| 118 |
|
| 119 |
- name: Update function namespace (Confirmation) |
| 120 |
community.general.scaleway_function_namespace: |
| 121 |
state: present |
| 122 |
name: '{{ name }}' |
| 123 |
region: '{{ scaleway_region }}' |
| 124 |
project_id: '{{ scw_project }}' |
| 125 |
description: '{{ updated_description }}' |
| 126 |
environment_variables: '{{ environment_variables }}' |
| 127 |
secret_environment_variables: '{{ secret_environment_variables }}' |
| 128 |
register: fn_update_confirmation_task |
| 129 |
|
| 130 |
- ansible.builtin.debug: |
| 131 |
var: fn_update_confirmation_task |
| 132 |
|
| 133 |
- name: Check module call result |
| 134 |
ansible.builtin.assert: |
| 135 |
that: |
| 136 |
- fn_update_confirmation_task is success |
| 137 |
- fn_update_confirmation_task is not changed |
| 138 |
- fn_update_confirmation_task.function_namespace.status == "ready" |
| 139 |
- "'hashed_value' in fn_creation_task.function_namespace.secret_environment_variables[0]" |
| 140 |
|
| 141 |
- name: Update function namespace secret variables (Check) |
| 142 |
check_mode: true |
| 143 |
community.general.scaleway_function_namespace: |
| 144 |
state: present |
| 145 |
name: '{{ name }}' |
| 146 |
region: '{{ scaleway_region }}' |
| 147 |
project_id: '{{ scw_project }}' |
| 148 |
description: '{{ updated_description }}' |
| 149 |
environment_variables: '{{ environment_variables }}' |
| 150 |
secret_environment_variables: '{{ updated_secret_environment_variables }}' |
| 151 |
register: fn_update_secret_check_task |
| 152 |
|
| 153 |
- ansible.builtin.debug: |
| 154 |
var: fn_update_secret_check_task |
| 155 |
|
| 156 |
- name: Check module call result |
| 157 |
ansible.builtin.assert: |
| 158 |
that: |
| 159 |
- fn_update_secret_check_task is success |
| 160 |
- fn_update_secret_check_task is changed |
| 161 |
|
| 162 |
- name: Update function namespace secret variables |
| 163 |
community.general.scaleway_function_namespace: |
| 164 |
state: present |
| 165 |
name: '{{ name }}' |
| 166 |
region: '{{ scaleway_region }}' |
| 167 |
project_id: '{{ scw_project }}' |
| 168 |
description: '{{ updated_description }}' |
| 169 |
environment_variables: '{{ environment_variables }}' |
| 170 |
secret_environment_variables: '{{ updated_secret_environment_variables }}' |
| 171 |
register: fn_update_secret_task |
| 172 |
|
| 173 |
- ansible.builtin.debug: |
| 174 |
var: fn_update_secret_task |
| 175 |
|
| 176 |
- name: Check module call result |
| 177 |
ansible.builtin.assert: |
| 178 |
that: |
| 179 |
- fn_update_secret_task is success |
| 180 |
- fn_update_secret_task is changed |
| 181 |
- fn_update_secret_task.function_namespace.status == "ready" |
| 182 |
- "'hashed_value' in fn_update_secret_task.function_namespace.secret_environment_variables[0]" |
| 183 |
|
| 184 |
- name: Update function namespace secret variables (Confirmation) |
| 185 |
community.general.scaleway_function_namespace: |
| 186 |
state: present |
| 187 |
name: '{{ name }}' |
| 188 |
region: '{{ scaleway_region }}' |
| 189 |
project_id: '{{ scw_project }}' |
| 190 |
description: '{{ updated_description }}' |
| 191 |
environment_variables: '{{ environment_variables }}' |
| 192 |
secret_environment_variables: '{{ updated_secret_environment_variables }}' |
| 193 |
register: fn_update_secret_confirmation_task |
| 194 |
|
| 195 |
- ansible.builtin.debug: |
| 196 |
var: fn_update_secret_confirmation_task |
| 197 |
|
| 198 |
- name: Check module call result |
| 199 |
ansible.builtin.assert: |
| 200 |
that: |
| 201 |
- fn_update_secret_confirmation_task is success |
| 202 |
- fn_update_secret_confirmation_task is not changed |
| 203 |
- fn_update_secret_confirmation_task.function_namespace.status == "ready" |
| 204 |
- "'hashed_value' in fn_update_secret_confirmation_task.function_namespace.secret_environment_variables[0]" |
| 205 |
|
| 206 |
- name: Delete function namespace (Check) |
| 207 |
check_mode: true |
| 208 |
community.general.scaleway_function_namespace: |
| 209 |
state: absent |
| 210 |
name: '{{ name }}' |
| 211 |
region: '{{ scaleway_region }}' |
| 212 |
description: '{{ description }}' |
| 213 |
project_id: '{{ scw_project }}' |
| 214 |
register: fn_deletion_check_task |
| 215 |
|
| 216 |
- ansible.builtin.debug: |
| 217 |
var: fn_deletion_check_task |
| 218 |
|
| 219 |
- name: Check module call result |
| 220 |
ansible.builtin.assert: |
| 221 |
that: |
| 222 |
- fn_deletion_check_task is success |
| 223 |
- fn_deletion_check_task is changed |
| 224 |
|
| 225 |
- name: Delete function namespace |
| 226 |
community.general.scaleway_function_namespace: |
| 227 |
state: absent |
| 228 |
name: '{{ name }}' |
| 229 |
region: '{{ scaleway_region }}' |
| 230 |
description: '{{ description }}' |
| 231 |
project_id: '{{ scw_project }}' |
| 232 |
register: fn_deletion_task |
| 233 |
|
| 234 |
- ansible.builtin.debug: |
| 235 |
var: fn_deletion_task |
| 236 |
|
| 237 |
- name: Check module call result |
| 238 |
ansible.builtin.assert: |
| 239 |
that: |
| 240 |
- fn_deletion_task is success |
| 241 |
- fn_deletion_task is changed |
| 242 |
- "'hashed_value' in fn_creation_task.function_namespace.secret_environment_variables[0]" |
| 243 |
|
| 244 |
- name: Delete function namespace (Confirmation) |
| 245 |
community.general.scaleway_function_namespace: |
| 246 |
state: absent |
| 247 |
name: '{{ name }}' |
| 248 |
region: '{{ scaleway_region }}' |
| 249 |
description: '{{ description }}' |
| 250 |
project_id: '{{ scw_project }}' |
| 251 |
register: fn_deletion_confirmation_task |
| 252 |
|
| 253 |
- ansible.builtin.debug: |
| 254 |
var: fn_deletion_confirmation_task |
| 255 |
|
| 256 |
- name: Check module call result |
| 257 |
ansible.builtin.assert: |
| 258 |
that: |
| 259 |
- fn_deletion_confirmation_task is success |
| 260 |
- fn_deletion_confirmation_task is not changed |