| 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 registry (Check) |
| 12 |
check_mode: true |
| 13 |
community.general.scaleway_container_registry: |
| 14 |
state: present |
| 15 |
name: '{{ name }}' |
| 16 |
region: '{{ scaleway_region }}' |
| 17 |
project_id: '{{ scw_project }}' |
| 18 |
description: '{{ description }}' |
| 19 |
register: cr_creation_check_task |
| 20 |
|
| 21 |
- ansible.builtin.debug: |
| 22 |
var: cr_creation_check_task |
| 23 |
|
| 24 |
- name: Check module call result |
| 25 |
ansible.builtin.assert: |
| 26 |
that: |
| 27 |
- cr_creation_check_task is success |
| 28 |
- cr_creation_check_task is changed |
| 29 |
|
| 30 |
- name: Create container_registry |
| 31 |
community.general.scaleway_container_registry: |
| 32 |
state: present |
| 33 |
name: '{{ name }}' |
| 34 |
region: '{{ scaleway_region }}' |
| 35 |
project_id: '{{ scw_project }}' |
| 36 |
description: '{{ description }}' |
| 37 |
register: cr_creation_task |
| 38 |
|
| 39 |
- ansible.builtin.debug: |
| 40 |
var: cr_creation_task |
| 41 |
|
| 42 |
- name: Check module call result |
| 43 |
ansible.builtin.assert: |
| 44 |
that: |
| 45 |
- cr_creation_task is success |
| 46 |
- cr_creation_task is changed |
| 47 |
- cr_creation_task.container_registry.status == "ready" |
| 48 |
|
| 49 |
- name: Create container registry (Confirmation) |
| 50 |
community.general.scaleway_container_registry: |
| 51 |
state: present |
| 52 |
name: '{{ name }}' |
| 53 |
region: '{{ scaleway_region }}' |
| 54 |
project_id: '{{ scw_project }}' |
| 55 |
description: '{{ description }}' |
| 56 |
register: cr_creation_confirmation_task |
| 57 |
|
| 58 |
- ansible.builtin.debug: |
| 59 |
var: cr_creation_confirmation_task |
| 60 |
|
| 61 |
- name: Check module call result |
| 62 |
ansible.builtin.assert: |
| 63 |
that: |
| 64 |
- cr_creation_confirmation_task is success |
| 65 |
- cr_creation_confirmation_task is not changed |
| 66 |
- cr_creation_confirmation_task.container_registry.status == "ready" |
| 67 |
|
| 68 |
- name: Update container registry (Check) |
| 69 |
check_mode: true |
| 70 |
community.general.scaleway_container_registry: |
| 71 |
state: present |
| 72 |
name: '{{ name }}' |
| 73 |
region: '{{ scaleway_region }}' |
| 74 |
project_id: '{{ scw_project }}' |
| 75 |
description: '{{ updated_description }}' |
| 76 |
register: cr_update_check_task |
| 77 |
|
| 78 |
- ansible.builtin.debug: |
| 79 |
var: cr_update_check_task |
| 80 |
|
| 81 |
- name: Check module call result |
| 82 |
ansible.builtin.assert: |
| 83 |
that: |
| 84 |
- cr_update_check_task is success |
| 85 |
- cr_update_check_task is changed |
| 86 |
|
| 87 |
- name: Update container registry |
| 88 |
community.general.scaleway_container_registry: |
| 89 |
state: present |
| 90 |
name: '{{ name }}' |
| 91 |
region: '{{ scaleway_region }}' |
| 92 |
project_id: '{{ scw_project }}' |
| 93 |
description: '{{ updated_description }}' |
| 94 |
register: cr_update_task |
| 95 |
|
| 96 |
- ansible.builtin.debug: |
| 97 |
var: cr_update_task |
| 98 |
|
| 99 |
- name: Check module call result |
| 100 |
ansible.builtin.assert: |
| 101 |
that: |
| 102 |
- cr_update_task is success |
| 103 |
- cr_update_task is changed |
| 104 |
- cr_update_task.container_registry.status == "ready" |
| 105 |
|
| 106 |
- name: Update container registry (Confirmation) |
| 107 |
community.general.scaleway_container_registry: |
| 108 |
state: present |
| 109 |
name: '{{ name }}' |
| 110 |
region: '{{ scaleway_region }}' |
| 111 |
project_id: '{{ scw_project }}' |
| 112 |
description: '{{ updated_description }}' |
| 113 |
register: cr_update_confirmation_task |
| 114 |
|
| 115 |
- ansible.builtin.debug: |
| 116 |
var: cr_update_confirmation_task |
| 117 |
|
| 118 |
- name: Check module call result |
| 119 |
ansible.builtin.assert: |
| 120 |
that: |
| 121 |
- cr_update_confirmation_task is success |
| 122 |
- cr_update_confirmation_task is not changed |
| 123 |
- cr_update_confirmation_task.container_registry.status == "ready" |
| 124 |
|
| 125 |
- name: Delete container registry (Check) |
| 126 |
check_mode: true |
| 127 |
community.general.scaleway_container_registry: |
| 128 |
state: absent |
| 129 |
name: '{{ name }}' |
| 130 |
region: '{{ scaleway_region }}' |
| 131 |
description: '{{ description }}' |
| 132 |
project_id: '{{ scw_project }}' |
| 133 |
register: cr_deletion_check_task |
| 134 |
|
| 135 |
- ansible.builtin.debug: |
| 136 |
var: cr_deletion_check_task |
| 137 |
|
| 138 |
- name: Check module call result |
| 139 |
ansible.builtin.assert: |
| 140 |
that: |
| 141 |
- cr_deletion_check_task is success |
| 142 |
- cr_deletion_check_task is changed |
| 143 |
|
| 144 |
- name: Delete container registry |
| 145 |
community.general.scaleway_container_registry: |
| 146 |
state: absent |
| 147 |
name: '{{ name }}' |
| 148 |
region: '{{ scaleway_region }}' |
| 149 |
description: '{{ description }}' |
| 150 |
project_id: '{{ scw_project }}' |
| 151 |
register: cr_deletion_task |
| 152 |
|
| 153 |
- ansible.builtin.debug: |
| 154 |
var: cr_deletion_task |
| 155 |
|
| 156 |
- name: Check module call result |
| 157 |
ansible.builtin.assert: |
| 158 |
that: |
| 159 |
- cr_deletion_task is success |
| 160 |
- cr_deletion_task is changed |
| 161 |
|
| 162 |
- name: Delete container registry (Confirmation) |
| 163 |
community.general.scaleway_container_registry: |
| 164 |
state: absent |
| 165 |
name: '{{ name }}' |
| 166 |
region: '{{ scaleway_region }}' |
| 167 |
description: '{{ description }}' |
| 168 |
project_id: '{{ scw_project }}' |
| 169 |
register: cr_deletion_confirmation_task |
| 170 |
|
| 171 |
- ansible.builtin.debug: |
| 172 |
var: cr_deletion_confirmation_task |
| 173 |
|
| 174 |
- name: Check module call result |
| 175 |
ansible.builtin.assert: |
| 176 |
that: |
| 177 |
- cr_deletion_confirmation_task is success |
| 178 |
- cr_deletion_confirmation_task is not changed |