mirror of https://github.com/ansible/ansible.git
Add an option to enable public ip at server creation (#44826)
parent
2fe150a1ef
commit
7c7a7efbbe
@ -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
|
@ -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
|
||||
|
@ -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
|
Loading…
Reference in New Issue