Add an option to enable public ip at server creation (#44826)

This commit is contained in:
Rémy Léone 2018-09-20 18:13:26 +02:00 committed by ansibot
parent 2fe150a1ef
commit 7c7a7efbbe
5 changed files with 639 additions and 392 deletions

View file

@ -29,6 +29,15 @@ extends_documentation_fragment: scaleway
options:
public_ip:
description:
- Manage public IP on a Scaleway server
- Could be Scaleway IP address UUID
- C(dynamic) Means that IP is destroyed at the same time the host is destroyed
- C(absent) Means no public IP at all
version_added: '2.8'
default: absent
enable_ipv6:
description:
- Enable public IPv6 connectivity on the instance
@ -234,16 +243,45 @@ def wait_to_complete_state_transition(compute_api, server):
compute_api.module.fail_json(msg="Server takes too long to finish its transition")
def public_ip_payload(compute_api, public_ip):
# We don't want a public ip
if public_ip in ("absent",):
return {"dynamic_ip_required": False}
# IP is only attached to the instance and is released as soon as the instance terminates
if public_ip in ("dynamic", "allocated"):
return {"dynamic_ip_required": True}
# We check that the IP we want to attach exists, if so its ID is returned
response = compute_api.get("ips")
if not response.ok:
msg = 'Error during public IP validation: (%s) %s' % (response.status_code, response.json)
compute_api.module.fail_json(msg=msg)
ip_list = []
try:
ip_list = response.json["ips"]
except KeyError:
compute_api.module.fail_json(msg="Error in getting the IP information from: %s" % response.json)
lookup = [ip["id"] for ip in ip_list]
if public_ip in lookup:
return {"public_ip": public_ip}
def create_server(compute_api, server):
compute_api.module.debug("Starting a create_server")
target_server = None
payload = {"enable_ipv6": server["enable_ipv6"],
"tags": server["tags"],
"commercial_type": server["commercial_type"],
"image": server["image"],
"dynamic_ip_required": server["dynamic_ip_required"],
"name": server["name"],
"organization": server["organization"]}
response = compute_api.post(path="servers",
data={"enable_ipv6": server["enable_ipv6"],
"tags": server["tags"],
"commercial_type": server["commercial_type"],
"image": server["image"],
"name": server["name"],
"organization": server["organization"]})
data=payload)
if not response.ok:
msg = 'Error during server creation: (%s) %s' % (response.status_code, response.json)
@ -577,6 +615,10 @@ def core(module):
compute_api = Scaleway(module=module)
# IP parameters of the wished server depends on the configuration
ip_payload = public_ip_payload(compute_api=compute_api, public_ip=module.params["public_ip"])
wished_server.update(ip_payload)
changed, summary = state_strategy[wished_server["state"]](compute_api=compute_api, wished_server=wished_server)
module.exit_json(changed=changed, msg=summary)
@ -589,6 +631,7 @@ def main():
region=dict(required=True, choices=SCALEWAY_LOCATION.keys()),
commercial_type=dict(required=True, choices=SCALEWAY_COMMERCIAL_TYPES),
enable_ipv6=dict(default=False, type="bool"),
public_ip=dict(default="absent"),
state=dict(choices=state_strategy.keys(), default='present'),
tags=dict(type="list", default=[]),
organization=dict(required=True),

View file

@ -4,3 +4,4 @@ scaleway_image_id: 89ee4018-f8c3-4dc4-a6b5-bca14f985ebe
scaleway_organization: '{{ scw_org }}'
scaleway_region: ams1
scaleway_commerial_type: START1-S
scaleway_name: scaleway_compute_test

View file

@ -0,0 +1,201 @@
- name: Create a server with no IP (Check)
check_mode: yes
scaleway_compute:
name: '{{ scaleway_name }}'
state: present
public_ip: absent
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
register: server_creation_absent_check_task
- debug: var=server_creation_absent_check_task
- assert:
that:
- server_creation_absent_check_task is success
- server_creation_absent_check_task is changed
- name: Create a server
scaleway_compute:
name: '{{ scaleway_name }}'
state: present
public_ip: absent
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
wait: true
register: server_creation_absent_task
- debug: var=server_creation_absent_task
- assert:
that:
- server_creation_absent_task is success
- server_creation_absent_task is changed
- name: Create a server (Confirmation)
scaleway_compute:
name: '{{ scaleway_name }}'
state: present
public_ip: absent
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
wait: true
register: server_creation_absent_confirmation_task
- debug: var=server_creation_absent_confirmation_task
- assert:
that:
- server_creation_absent_confirmation_task is success
- server_creation_absent_confirmation_task is not changed
# Add a dynamic IP to the instance
- name: Patch server tags (Check)
check_mode: yes
scaleway_compute:
name: '{{ scaleway_name }}'
state: present
public_ip: dynamic
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
register: ip_patching_check_task
- debug: var=ip_patching_check_task
- assert:
that:
- ip_patching_check_task is success
- ip_patching_check_task is changed
- name: Patch server tags
scaleway_compute:
name: '{{ scaleway_name }}'
state: present
public_ip: dynamic
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
wait: true
register: ip_patching_task
- debug: var=ip_patching_task
- assert:
that:
- ip_patching_task is success
- ip_patching_task is changed
- name: Patch server tags (Confirmation)
scaleway_compute:
name: '{{ scaleway_name }}'
state: present
public_ip: dynamic
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
wait: true
register: ip_patching_confirmation_task
- debug: var=ip_patching_confirmation_task
- assert:
that:
- ip_patching_confirmation_task is success
- ip_patching_confirmation_task is not changed
# Remove dynamic IP
- name: Patch server tags (Check)
check_mode: yes
scaleway_compute:
name: '{{ scaleway_name }}'
state: present
public_ip: absent
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
register: remove_ip_check_task
- debug: var=remove_ip_check_task
- assert:
that:
- remove_ip_check_task is success
- remove_ip_check_task is changed
- name: Patch server tags
scaleway_compute:
name: '{{ scaleway_name }}'
state: present
public_ip: absent
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
wait: true
register: remove_ip_task
- debug: var=remove_ip_task
- assert:
that:
- remove_ip_task is success
- remove_ip_task is changed
- name: Patch server tags (Confirmation)
scaleway_compute:
name: '{{ scaleway_name }}'
state: present
public_ip: absent
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
wait: true
register: remove_ip_confirmation_task
- debug: var=remove_ip_confirmation_task
- assert:
that:
- remove_ip_confirmation_task is success
- remove_ip_confirmation_task is not changed
- name: Destroy it
scaleway_compute:
name: '{{ scaleway_name }}'
state: absent
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
wait: true
register: server_destroy_task
- debug: var=server_destroy_task
- assert:
that:
- server_destroy_task is success
- server_destroy_task is changed

View file

@ -1,388 +1,4 @@
# SCW_API_KEY='XXX' SCW_ORG='YYY' ansible-playbook ./test/legacy/scaleway.yml --tags test_scaleway_compute
- name: Create a server (Check)
check_mode: yes
scaleway_compute:
name: foobar
state: present
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
register: server_creation_check_task
- debug: var=server_creation_check_task
- assert:
that:
- server_creation_check_task is success
- server_creation_check_task is changed
- name: Create a server
scaleway_compute:
name: foobar
state: present
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
wait: true
register: server_creation_task
- debug: var=server_creation_task
- assert:
that:
- server_creation_task is success
- server_creation_task is changed
- name: Create a server (Confirmation)
scaleway_compute:
name: foobar
state: present
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
wait: true
register: server_creation_confirmation_task
- debug: var=server_creation_confirmation_task
- assert:
that:
- server_creation_confirmation_task is success
- server_creation_confirmation_task is not changed
- name: Patch server tags (Check)
check_mode: yes
scaleway_compute:
name: foobar
state: present
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
tags:
- test
- www
register: server_patching_check_task
- debug: var=server_patching_check_task
- assert:
that:
- server_patching_check_task is success
- server_patching_check_task is changed
- name: Patch server tags
scaleway_compute:
name: foobar
state: present
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
wait: true
tags:
- test
- www
register: server_patching_task
- debug: var=server_patching_task
- assert:
that:
- server_patching_task is success
- server_patching_task is changed
- name: Patch server tags (Confirmation)
scaleway_compute:
name: foobar
state: present
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
wait: true
tags:
- test
- www
register: server_patching_confirmation_task
- debug: var=server_patching_confirmation_task
- assert:
that:
- server_patching_confirmation_task is success
- server_patching_confirmation_task is not changed
- name: Run it (Check mode)
check_mode: yes
scaleway_compute:
name: foobar
state: running
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
tags:
- test
- www
register: server_run_check_task
- debug: var=server_run_check_task
- assert:
that:
- server_run_check_task is success
- server_run_check_task is changed
- name: Run it
scaleway_compute:
name: foobar
state: running
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
wait: true
tags:
- test
- www
register: server_run_task
- debug: var=server_run_task
- assert:
that:
- server_run_task is success
- server_run_task is changed
- name: Run it
scaleway_compute:
name: foobar
state: running
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
wait: true
tags:
- test
- www
register: server_run_confirmation_task
- debug: var=server_run_confirmation_task
- assert:
that:
- server_run_confirmation_task is success
- server_run_confirmation_task is not changed
- name: Reboot it (Check mode)
check_mode: yes
scaleway_compute:
name: foobar
state: restarted
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
tags:
- test
- www
register: server_reboot_check_task
- debug: var=server_reboot_check_task
- assert:
that:
- server_reboot_check_task is success
- server_reboot_check_task is changed
- name: Reboot it
scaleway_compute:
name: foobar
state: restarted
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
wait: true
tags:
- test
- www
register: server_reboot_task
- debug: var=server_reboot_task
- assert:
that:
- server_reboot_task is success
- server_reboot_task is changed
- name: Stop it (Check mode)
check_mode: yes
scaleway_compute:
name: foobar
state: stopped
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
tags:
- test
- www
register: server_stop_check_task
- debug: var=server_stop_check_task
- assert:
that:
- server_stop_check_task is success
- server_stop_check_task is changed
- name: Stop it
scaleway_compute:
name: foobar
state: stopped
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
wait: true
tags:
- test
- www
register: server_stop_task
- debug: var=server_stop_task
- assert:
that:
- server_stop_task is success
- server_stop_task is changed
- name: Stop it (Confirmation)
scaleway_compute:
name: foobar
state: stopped
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
wait: true
tags:
- test
- www
register: server_stop_confirmation_task
- debug: var=server_stop_confirmation_task
- assert:
that:
- server_stop_confirmation_task is success
- server_stop_confirmation_task is not changed
- name: Destroy it (Check mode)
check_mode: yes
scaleway_compute:
name: foobar
state: absent
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
tags:
- test
- www
register: server_destroy_check_task
- debug: var=server_destroy_check_task
- assert:
that:
- server_destroy_check_task is success
- server_destroy_check_task is changed
- name: Destroy it
scaleway_compute:
name: foobar
state: absent
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
wait: true
tags:
- test
- www
register: server_destroy_task
- debug: var=server_destroy_task
- assert:
that:
- server_destroy_task is success
- server_destroy_task is changed
- name: Destroy it (Confirmation)
scaleway_compute:
name: foobar
state: absent
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
wait: true
tags:
- test
- www
register: server_destroy_confirmation_task
- debug: var=server_destroy_confirmation_task
- assert:
that:
- server_destroy_confirmation_task is success
- server_destroy_confirmation_task is not changed
- name: Testing for unauthorized organization
ignore_errors: yes
scaleway_compute:
name: foobar
state: present
image: '{{ scaleway_image_id }}'
organization: this-organization-does-not-exists
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
register: unauthorized_organization_task
- debug: var=unauthorized_organization_task
- assert:
that:
- unauthorized_organization_task is not success
- unauthorized_organization_task is not changed
- name: Testing for unexisting image
ignore_errors: yes
scaleway_compute:
name: foobar
state: present
image: this-image-does-not-exists
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
register: unexisting_image_check
- debug: var=unexisting_image_check
- assert:
that:
- unexisting_image_check is not success
- unexisting_image_check is not changed
- include_tasks: state.yml
- include_tasks: ip.yml

View file

@ -0,0 +1,386 @@
- name: Create a server (Check)
check_mode: yes
scaleway_compute:
name: '{{ scaleway_name }}'
state: present
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
register: server_creation_check_task
- debug: var=server_creation_check_task
- assert:
that:
- server_creation_check_task is success
- server_creation_check_task is changed
- name: Create a server
scaleway_compute:
name: '{{ scaleway_name }}'
state: present
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
wait: true
register: server_creation_task
- debug: var=server_creation_task
- assert:
that:
- server_creation_task is success
- server_creation_task is changed
- name: Create a server (Confirmation)
scaleway_compute:
name: '{{ scaleway_name }}'
state: present
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
wait: true
register: server_creation_confirmation_task
- debug: var=server_creation_confirmation_task
- assert:
that:
- server_creation_confirmation_task is success
- server_creation_confirmation_task is not changed
- name: Patch server tags (Check)
check_mode: yes
scaleway_compute:
name: '{{ scaleway_name }}'
state: present
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
tags:
- test
- www
register: server_patching_check_task
- debug: var=server_patching_check_task
- assert:
that:
- server_patching_check_task is success
- server_patching_check_task is changed
- name: Patch server tags
scaleway_compute:
name: '{{ scaleway_name }}'
state: present
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
wait: true
tags:
- test
- www
register: server_patching_task
- debug: var=server_patching_task
- assert:
that:
- server_patching_task is success
- server_patching_task is changed
- name: Patch server tags (Confirmation)
scaleway_compute:
name: '{{ scaleway_name }}'
state: present
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
wait: true
tags:
- test
- www
register: server_patching_confirmation_task
- debug: var=server_patching_confirmation_task
- assert:
that:
- server_patching_confirmation_task is success
- server_patching_confirmation_task is not changed
- name: Run it (Check mode)
check_mode: yes
scaleway_compute:
name: '{{ scaleway_name }}'
state: running
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
tags:
- test
- www
register: server_run_check_task
- debug: var=server_run_check_task
- assert:
that:
- server_run_check_task is success
- server_run_check_task is changed
- name: Run it
scaleway_compute:
name: '{{ scaleway_name }}'
state: running
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
wait: true
tags:
- test
- www
register: server_run_task
- debug: var=server_run_task
- assert:
that:
- server_run_task is success
- server_run_task is changed
- name: Run it
scaleway_compute:
name: '{{ scaleway_name }}'
state: running
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
wait: true
tags:
- test
- www
register: server_run_confirmation_task
- debug: var=server_run_confirmation_task
- assert:
that:
- server_run_confirmation_task is success
- server_run_confirmation_task is not changed
- name: Reboot it (Check mode)
check_mode: yes
scaleway_compute:
name: '{{ scaleway_name }}'
state: restarted
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
tags:
- test
- www
register: server_reboot_check_task
- debug: var=server_reboot_check_task
- assert:
that:
- server_reboot_check_task is success
- server_reboot_check_task is changed
- name: Reboot it
scaleway_compute:
name: '{{ scaleway_name }}'
state: restarted
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
wait: true
tags:
- test
- www
register: server_reboot_task
- debug: var=server_reboot_task
- assert:
that:
- server_reboot_task is success
- server_reboot_task is changed
- name: Stop it (Check mode)
check_mode: yes
scaleway_compute:
name: '{{ scaleway_name }}'
state: stopped
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
tags:
- test
- www
register: server_stop_check_task
- debug: var=server_stop_check_task
- assert:
that:
- server_stop_check_task is success
- server_stop_check_task is changed
- name: Stop it
scaleway_compute:
name: '{{ scaleway_name }}'
state: stopped
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
wait: true
tags:
- test
- www
register: server_stop_task
- debug: var=server_stop_task
- assert:
that:
- server_stop_task is success
- server_stop_task is changed
- name: Stop it (Confirmation)
scaleway_compute:
name: '{{ scaleway_name }}'
state: stopped
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
wait: true
tags:
- test
- www
register: server_stop_confirmation_task
- debug: var=server_stop_confirmation_task
- assert:
that:
- server_stop_confirmation_task is success
- server_stop_confirmation_task is not changed
- name: Destroy it (Check mode)
check_mode: yes
scaleway_compute:
name: '{{ scaleway_name }}'
state: absent
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
tags:
- test
- www
register: server_destroy_check_task
- debug: var=server_destroy_check_task
- assert:
that:
- server_destroy_check_task is success
- server_destroy_check_task is changed
- name: Destroy it
scaleway_compute:
name: '{{ scaleway_name }}'
state: absent
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
wait: true
tags:
- test
- www
register: server_destroy_task
- debug: var=server_destroy_task
- assert:
that:
- server_destroy_task is success
- server_destroy_task is changed
- name: Destroy it (Confirmation)
scaleway_compute:
name: '{{ scaleway_name }}'
state: absent
image: '{{ scaleway_image_id }}'
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
wait: true
tags:
- test
- www
register: server_destroy_confirmation_task
- debug: var=server_destroy_confirmation_task
- assert:
that:
- server_destroy_confirmation_task is success
- server_destroy_confirmation_task is not changed
- name: Testing for unauthorized organization
ignore_errors: yes
scaleway_compute:
name: '{{ scaleway_name }}'
state: present
image: '{{ scaleway_image_id }}'
organization: this-organization-does-not-exists
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
register: unauthorized_organization_task
- debug: var=unauthorized_organization_task
- assert:
that:
- unauthorized_organization_task is not success
- unauthorized_organization_task is not changed
- name: Testing for unexisting image
ignore_errors: yes
scaleway_compute:
name: '{{ scaleway_name }}'
state: present
image: this-image-does-not-exists
organization: '{{ scaleway_organization }}'
region: '{{ scaleway_region }}'
commercial_type: '{{ scaleway_commerial_type }}'
register: unexisting_image_check
- debug: var=unexisting_image_check
- assert:
that:
- unexisting_image_check is not success
- unexisting_image_check is not changed