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