| 1 |
--- |
| 2 |
# Copyright (c) Ansible Project |
| 3 |
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) |
| 4 |
# SPDX-License-Identifier: GPL-3.0-or-later |
| 5 |
|
| 6 |
- name: Create a server with no IP (Check) |
| 7 |
check_mode: true |
| 8 |
scaleway_compute: |
| 9 |
name: '{{ scaleway_name }}' |
| 10 |
state: present |
| 11 |
public_ip: absent |
| 12 |
image: '{{ scaleway_image_id }}' |
| 13 |
organization: '{{ scaleway_organization }}' |
| 14 |
region: '{{ scaleway_region }}' |
| 15 |
commercial_type: '{{ scaleway_commerial_type }}' |
| 16 |
|
| 17 |
register: server_creation_absent_check_task |
| 18 |
|
| 19 |
- debug: var=server_creation_absent_check_task |
| 20 |
|
| 21 |
- assert: |
| 22 |
that: |
| 23 |
- server_creation_absent_check_task is success |
| 24 |
- server_creation_absent_check_task is changed |
| 25 |
|
| 26 |
- name: Create a server |
| 27 |
scaleway_compute: |
| 28 |
name: '{{ scaleway_name }}' |
| 29 |
state: present |
| 30 |
public_ip: absent |
| 31 |
image: '{{ scaleway_image_id }}' |
| 32 |
organization: '{{ scaleway_organization }}' |
| 33 |
region: '{{ scaleway_region }}' |
| 34 |
commercial_type: '{{ scaleway_commerial_type }}' |
| 35 |
wait: true |
| 36 |
|
| 37 |
register: server_creation_absent_task |
| 38 |
|
| 39 |
- debug: var=server_creation_absent_task |
| 40 |
|
| 41 |
- assert: |
| 42 |
that: |
| 43 |
- server_creation_absent_task is success |
| 44 |
- server_creation_absent_task is changed |
| 45 |
|
| 46 |
- name: Create a server (Confirmation) |
| 47 |
scaleway_compute: |
| 48 |
name: '{{ scaleway_name }}' |
| 49 |
state: present |
| 50 |
public_ip: absent |
| 51 |
image: '{{ scaleway_image_id }}' |
| 52 |
organization: '{{ scaleway_organization }}' |
| 53 |
region: '{{ scaleway_region }}' |
| 54 |
commercial_type: '{{ scaleway_commerial_type }}' |
| 55 |
wait: true |
| 56 |
|
| 57 |
register: server_creation_absent_confirmation_task |
| 58 |
|
| 59 |
- debug: var=server_creation_absent_confirmation_task |
| 60 |
|
| 61 |
- assert: |
| 62 |
that: |
| 63 |
- server_creation_absent_confirmation_task is success |
| 64 |
- server_creation_absent_confirmation_task is not changed |
| 65 |
|
| 66 |
# Add a dynamic IP to the instance |
| 67 |
|
| 68 |
- name: Patch server tags (Check) |
| 69 |
check_mode: true |
| 70 |
scaleway_compute: |
| 71 |
name: '{{ scaleway_name }}' |
| 72 |
state: present |
| 73 |
public_ip: dynamic |
| 74 |
image: '{{ scaleway_image_id }}' |
| 75 |
organization: '{{ scaleway_organization }}' |
| 76 |
region: '{{ scaleway_region }}' |
| 77 |
commercial_type: '{{ scaleway_commerial_type }}' |
| 78 |
|
| 79 |
register: ip_patching_check_task |
| 80 |
|
| 81 |
- debug: var=ip_patching_check_task |
| 82 |
|
| 83 |
- assert: |
| 84 |
that: |
| 85 |
- ip_patching_check_task is success |
| 86 |
- ip_patching_check_task is changed |
| 87 |
|
| 88 |
- name: Patch server tags |
| 89 |
scaleway_compute: |
| 90 |
name: '{{ scaleway_name }}' |
| 91 |
state: present |
| 92 |
public_ip: dynamic |
| 93 |
image: '{{ scaleway_image_id }}' |
| 94 |
organization: '{{ scaleway_organization }}' |
| 95 |
region: '{{ scaleway_region }}' |
| 96 |
commercial_type: '{{ scaleway_commerial_type }}' |
| 97 |
wait: true |
| 98 |
register: ip_patching_task |
| 99 |
|
| 100 |
- debug: var=ip_patching_task |
| 101 |
|
| 102 |
- assert: |
| 103 |
that: |
| 104 |
- ip_patching_task is success |
| 105 |
- ip_patching_task is changed |
| 106 |
|
| 107 |
- name: Patch server tags (Confirmation) |
| 108 |
scaleway_compute: |
| 109 |
name: '{{ scaleway_name }}' |
| 110 |
state: present |
| 111 |
public_ip: dynamic |
| 112 |
image: '{{ scaleway_image_id }}' |
| 113 |
organization: '{{ scaleway_organization }}' |
| 114 |
region: '{{ scaleway_region }}' |
| 115 |
commercial_type: '{{ scaleway_commerial_type }}' |
| 116 |
wait: true |
| 117 |
|
| 118 |
register: ip_patching_confirmation_task |
| 119 |
|
| 120 |
- debug: var=ip_patching_confirmation_task |
| 121 |
|
| 122 |
- assert: |
| 123 |
that: |
| 124 |
- ip_patching_confirmation_task is success |
| 125 |
- ip_patching_confirmation_task is not changed |
| 126 |
|
| 127 |
# Remove dynamic IP |
| 128 |
|
| 129 |
- name: Patch server tags (Check) |
| 130 |
check_mode: true |
| 131 |
scaleway_compute: |
| 132 |
name: '{{ scaleway_name }}' |
| 133 |
state: present |
| 134 |
public_ip: absent |
| 135 |
image: '{{ scaleway_image_id }}' |
| 136 |
organization: '{{ scaleway_organization }}' |
| 137 |
region: '{{ scaleway_region }}' |
| 138 |
commercial_type: '{{ scaleway_commerial_type }}' |
| 139 |
|
| 140 |
register: remove_ip_check_task |
| 141 |
|
| 142 |
- debug: var=remove_ip_check_task |
| 143 |
|
| 144 |
- assert: |
| 145 |
that: |
| 146 |
- remove_ip_check_task is success |
| 147 |
- remove_ip_check_task is changed |
| 148 |
|
| 149 |
- name: Patch server tags |
| 150 |
scaleway_compute: |
| 151 |
name: '{{ scaleway_name }}' |
| 152 |
state: present |
| 153 |
public_ip: absent |
| 154 |
image: '{{ scaleway_image_id }}' |
| 155 |
organization: '{{ scaleway_organization }}' |
| 156 |
region: '{{ scaleway_region }}' |
| 157 |
commercial_type: '{{ scaleway_commerial_type }}' |
| 158 |
wait: true |
| 159 |
|
| 160 |
register: remove_ip_task |
| 161 |
|
| 162 |
- debug: var=remove_ip_task |
| 163 |
|
| 164 |
- assert: |
| 165 |
that: |
| 166 |
- remove_ip_task is success |
| 167 |
- remove_ip_task is changed |
| 168 |
|
| 169 |
- name: Patch server tags (Confirmation) |
| 170 |
scaleway_compute: |
| 171 |
name: '{{ scaleway_name }}' |
| 172 |
state: present |
| 173 |
public_ip: absent |
| 174 |
image: '{{ scaleway_image_id }}' |
| 175 |
organization: '{{ scaleway_organization }}' |
| 176 |
region: '{{ scaleway_region }}' |
| 177 |
commercial_type: '{{ scaleway_commerial_type }}' |
| 178 |
wait: true |
| 179 |
|
| 180 |
register: remove_ip_confirmation_task |
| 181 |
|
| 182 |
- debug: var=remove_ip_confirmation_task |
| 183 |
|
| 184 |
- assert: |
| 185 |
that: |
| 186 |
- remove_ip_confirmation_task is success |
| 187 |
- remove_ip_confirmation_task is not changed |
| 188 |
|
| 189 |
- name: Destroy it |
| 190 |
scaleway_compute: |
| 191 |
name: '{{ scaleway_name }}' |
| 192 |
state: absent |
| 193 |
image: '{{ scaleway_image_id }}' |
| 194 |
organization: '{{ scaleway_organization }}' |
| 195 |
region: '{{ scaleway_region }}' |
| 196 |
commercial_type: '{{ scaleway_commerial_type }}' |
| 197 |
wait: true |
| 198 |
|
| 199 |
register: server_destroy_task |
| 200 |
|
| 201 |
- debug: var=server_destroy_task |
| 202 |
|
| 203 |
- assert: |
| 204 |
that: |
| 205 |
- server_destroy_task is success |
| 206 |
- server_destroy_task is changed |