mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00:00
Migrate Scaleway tests to integration tests
This commit is contained in:
13
test/integration/cloud-config-scaleway.ini.template
Normal file
13
test/integration/cloud-config-scaleway.ini.template
Normal file
@@ -0,0 +1,13 @@
|
||||
# This is the configuration template for ansible-test Scaleway integration tests.
|
||||
#
|
||||
# You do not need this template if you are:
|
||||
#
|
||||
# 1) Running integration tests without using ansible-test.
|
||||
#
|
||||
# If you want to test against the Vultr public API,
|
||||
# fill in the values below and save this file without the .template extension.
|
||||
# This will cause ansible-test to use the given configuration.
|
||||
|
||||
[default]
|
||||
key = @KEY
|
||||
org = @ORG
|
||||
2
test/integration/targets/scaleway_compute/aliases
Normal file
2
test/integration/targets/scaleway_compute/aliases
Normal file
@@ -0,0 +1,2 @@
|
||||
cloud/scaleway
|
||||
unsupported
|
||||
@@ -0,0 +1,9 @@
|
||||
# Below information has been taken from https://developer.scaleway.com/#servers
|
||||
---
|
||||
scaleway_image_id: 6a601340-19c1-4ca7-9c1c-0704bcc9f5fe
|
||||
scaleway_organization: '{{ scw_org }}'
|
||||
scaleway_region: ams1
|
||||
scaleway_commerial_type: START1-S
|
||||
scaleway_name: scaleway_compute_test
|
||||
first_server_name: scaleway_compute_test_first
|
||||
second_server_name: scaleway_compute_test_second
|
||||
201
test/integration/targets/scaleway_compute/tasks/ip.yml
Normal file
201
test/integration/targets/scaleway_compute/tasks/ip.yml
Normal 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
|
||||
6
test/integration/targets/scaleway_compute/tasks/main.yml
Normal file
6
test/integration/targets/scaleway_compute/tasks/main.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
# SCW_API_KEY='XXX' SCW_ORG='YYY' ansible-playbook ./test/legacy/scaleway.yml --tags test_scaleway_compute
|
||||
|
||||
- include_tasks: state.yml
|
||||
- include_tasks: ip.yml
|
||||
- include_tasks: security_group.yml
|
||||
- include_tasks: pagination.yml
|
||||
@@ -0,0 +1,71 @@
|
||||
- name: Create a first server
|
||||
scaleway_compute:
|
||||
name: '{{ first_server_name }}'
|
||||
state: present
|
||||
image: '{{ scaleway_image_id }}'
|
||||
organization: '{{ scaleway_organization }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
commercial_type: '{{ scaleway_commerial_type }}'
|
||||
wait: true
|
||||
|
||||
- name: Create a second server
|
||||
scaleway_compute:
|
||||
name: '{{ second_server_name }}'
|
||||
state: present
|
||||
image: '{{ scaleway_image_id }}'
|
||||
organization: '{{ scaleway_organization }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
commercial_type: '{{ scaleway_commerial_type }}'
|
||||
wait: true
|
||||
|
||||
- name: Get server informations of the first page
|
||||
scaleway_server_facts:
|
||||
region: par1
|
||||
query_parameters:
|
||||
per_page: 1
|
||||
page: 1
|
||||
register: first_page
|
||||
|
||||
- debug: var=first_page
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- first_page is success
|
||||
|
||||
- name: Get server informations of the second page
|
||||
scaleway_server_facts:
|
||||
region: par1
|
||||
query_parameters:
|
||||
per_page: 1
|
||||
page: 2
|
||||
register: second_page
|
||||
|
||||
- debug: var=second_page
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- second_page is success
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- first_page.ansible_facts.scaleway_server_facts[0].id != second_page.ansible_facts.scaleway_server_facts[0].id
|
||||
|
||||
- name: Delete first server
|
||||
scaleway_compute:
|
||||
name: '{{ first_server_name }}'
|
||||
state: absent
|
||||
image: '{{ scaleway_image_id }}'
|
||||
organization: '{{ scaleway_organization }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
commercial_type: '{{ scaleway_commerial_type }}'
|
||||
wait: true
|
||||
|
||||
- name: Delete second server
|
||||
scaleway_compute:
|
||||
name: '{{ second_server_name }}'
|
||||
state: absent
|
||||
image: '{{ scaleway_image_id }}'
|
||||
organization: '{{ scaleway_organization }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
commercial_type: '{{ scaleway_commerial_type }}'
|
||||
wait: true
|
||||
@@ -0,0 +1,147 @@
|
||||
- name: Create a scaleway security_group
|
||||
scaleway_security_group:
|
||||
state: present
|
||||
region: '{{ scaleway_region }}'
|
||||
name: test_compute
|
||||
description: test_compute
|
||||
organization: '{{ scaleway_organization }}'
|
||||
stateful: true
|
||||
inbound_default_policy: accept
|
||||
outbound_default_policy: accept
|
||||
organization_default: false
|
||||
register: security_group
|
||||
|
||||
- debug: var=security_group
|
||||
|
||||
- block:
|
||||
- name: Create a server with security_group (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 }}'
|
||||
security_group: '{{ security_group.scaleway_security_group.id }}'
|
||||
|
||||
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 }}'
|
||||
security_group: '{{ security_group.scaleway_security_group.id }}'
|
||||
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 with security_group (Confirmation)
|
||||
scaleway_compute:
|
||||
name: '{{ scaleway_name }}'
|
||||
state: present
|
||||
image: '{{ scaleway_image_id }}'
|
||||
organization: '{{ scaleway_organization }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
commercial_type: '{{ scaleway_commerial_type }}'
|
||||
security_group: '{{ security_group.scaleway_security_group.id }}'
|
||||
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: Keep current security_group (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 }}'
|
||||
security_group: '{{ security_group.scaleway_security_group.id }}'
|
||||
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: Keep current security_group
|
||||
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
|
||||
|
||||
always:
|
||||
- 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
|
||||
|
||||
- name: Create a scaleway security_group
|
||||
scaleway_security_group:
|
||||
state: absent
|
||||
region: '{{ scaleway_region }}'
|
||||
name: test_compute
|
||||
description: test_compute
|
||||
organization: '{{ scaleway_organization }}'
|
||||
stateful: true
|
||||
inbound_default_policy: accept
|
||||
outbound_default_policy: accept
|
||||
organization_default: false
|
||||
387
test/integration/targets/scaleway_compute/tasks/state.yml
Normal file
387
test/integration/targets/scaleway_compute/tasks/state.yml
Normal file
@@ -0,0 +1,387 @@
|
||||
- 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
|
||||
- unexisting_image_check.msg == "Error in getting image this-image-does-not-exists on https://cp-{{scaleway_region}}.scaleway.com"
|
||||
2
test/integration/targets/scaleway_image_facts/aliases
Normal file
2
test/integration/targets/scaleway_image_facts/aliases
Normal file
@@ -0,0 +1,2 @@
|
||||
cloud/scaleway
|
||||
unsupported
|
||||
30
test/integration/targets/scaleway_image_facts/tasks/main.yml
Normal file
30
test/integration/targets/scaleway_image_facts/tasks/main.yml
Normal file
@@ -0,0 +1,30 @@
|
||||
# SCW_API_KEY='XXX' ansible-playbook ./test/legacy/scaleway.yml --tags test_scaleway_image_facts
|
||||
|
||||
|
||||
- name: Get image informations and register it in a variable
|
||||
scaleway_image_facts:
|
||||
region: par1
|
||||
register: images
|
||||
|
||||
- name: Display images variable
|
||||
debug:
|
||||
var: images
|
||||
|
||||
- name: Ensure retrieval of images facts is success
|
||||
assert:
|
||||
that:
|
||||
- images is success
|
||||
|
||||
- name: Get image informations from ams1 and register it in a variable
|
||||
scaleway_image_facts:
|
||||
region: ams1
|
||||
register: images_ams1
|
||||
|
||||
- name: Display images variable from ams1
|
||||
debug:
|
||||
var: images_ams1
|
||||
|
||||
- name: Ensure retrieval of images facts is success
|
||||
assert:
|
||||
that:
|
||||
- images_ams1 is success
|
||||
2
test/integration/targets/scaleway_ip/aliases
Normal file
2
test/integration/targets/scaleway_ip/aliases
Normal file
@@ -0,0 +1,2 @@
|
||||
cloud/scaleway
|
||||
unsupported
|
||||
7
test/integration/targets/scaleway_ip/defaults/main.yml
Normal file
7
test/integration/targets/scaleway_ip/defaults/main.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
scaleway_organization: '{{ scw_org }}'
|
||||
scaleway_region: ams1
|
||||
scaleway_image_id: 89ee4018-f8c3-4dc4-a6b5-bca14f985ebe
|
||||
scaleway_commerial_type: START1-S
|
||||
scaleway_server_name: scaleway_ip_test_server
|
||||
scaleway_reverse_name: scaleway.com
|
||||
441
test/integration/targets/scaleway_ip/tasks/main.yml
Normal file
441
test/integration/targets/scaleway_ip/tasks/main.yml
Normal file
@@ -0,0 +1,441 @@
|
||||
# SCW_API_KEY='XXX' SCW_ORG='YYY' ansible-playbook ./test/legacy/scaleway.yml --tags test_scaleway_ip
|
||||
|
||||
- name: Create IP (Check)
|
||||
check_mode: yes
|
||||
scaleway_ip:
|
||||
state: present
|
||||
region: '{{ scaleway_region }}'
|
||||
organization: '{{ scaleway_organization }}'
|
||||
register: ip_creation_check_task
|
||||
|
||||
- debug: var=ip_creation_check_task
|
||||
|
||||
- name: ip_creation_check_task is success
|
||||
assert:
|
||||
that:
|
||||
- ip_creation_check_task is success
|
||||
|
||||
- name: ip_creation_check_task is changed
|
||||
assert:
|
||||
that:
|
||||
- ip_creation_check_task is changed
|
||||
|
||||
- name: Create IP
|
||||
scaleway_ip:
|
||||
state: present
|
||||
region: '{{ scaleway_region }}'
|
||||
organization: '{{ scaleway_organization }}'
|
||||
register: ip_creation_task
|
||||
|
||||
- debug: var=ip_creation_task
|
||||
|
||||
- name: ip_creation_task is success
|
||||
assert:
|
||||
that:
|
||||
- ip_creation_task is success
|
||||
|
||||
- name: ip_creation_task is changed
|
||||
assert:
|
||||
that:
|
||||
- ip_creation_task is changed
|
||||
|
||||
- name: ip_creation_task.scaleway_ip.server is none
|
||||
assert:
|
||||
that:
|
||||
- '{{ ip_creation_task.scaleway_ip.server is none }}'
|
||||
|
||||
- name: Create IP (Confirmation)
|
||||
scaleway_ip:
|
||||
id: '{{ ip_creation_task.scaleway_ip.id }}'
|
||||
state: present
|
||||
region: '{{ scaleway_region }}'
|
||||
organization: '{{ scaleway_organization }}'
|
||||
register: ip_creation_confirmation_task
|
||||
|
||||
- debug: var=ip_creation_confirmation_task
|
||||
|
||||
- name: ip_creation_confirmation_task is success
|
||||
assert:
|
||||
that:
|
||||
- ip_creation_confirmation_task is success
|
||||
|
||||
- name: ip_creation_confirmation_task is not changed
|
||||
assert:
|
||||
that:
|
||||
- ip_creation_confirmation_task is not changed
|
||||
|
||||
- name: ip_creation_confirmation_task.scaleway_ip.server is none
|
||||
assert:
|
||||
that:
|
||||
- '{{ ip_creation_task.scaleway_ip.server is none }}'
|
||||
|
||||
- name: Assign reverse to server (Check)
|
||||
check_mode: yes
|
||||
scaleway_ip:
|
||||
state: present
|
||||
id: '{{ ip_creation_task.scaleway_ip.id }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
organization: '{{ scaleway_organization }}'
|
||||
reverse: '{{ scaleway_reverse_name }}'
|
||||
register: ip_reverse_assignation_check_task
|
||||
|
||||
- debug: var=ip_reverse_assignation_check_task
|
||||
|
||||
- name: ip_reverse_assignation_check_task is success
|
||||
assert:
|
||||
that:
|
||||
- ip_reverse_assignation_check_task is success
|
||||
|
||||
- name: ip_reverse_assignation_check_task is success
|
||||
assert:
|
||||
that:
|
||||
- ip_reverse_assignation_check_task is success
|
||||
|
||||
- name: Assign reverse to an IP
|
||||
scaleway_ip:
|
||||
state: present
|
||||
id: '{{ ip_creation_task.scaleway_ip.id }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
organization: '{{ scaleway_organization }}'
|
||||
reverse: '{{ scaleway_reverse_name }}'
|
||||
register: ip_reverse_assignation_task
|
||||
|
||||
- debug: var=ip_reverse_assignation_task
|
||||
|
||||
- name: ip_reverse_assignation_task is success
|
||||
assert:
|
||||
that:
|
||||
- ip_reverse_assignation_task is success
|
||||
|
||||
- name: ip_reverse_assignation_task is changed
|
||||
assert:
|
||||
that:
|
||||
- ip_reverse_assignation_task is changed
|
||||
|
||||
- name: Assign reverse to an IP (Confirmation)
|
||||
scaleway_ip:
|
||||
state: present
|
||||
id: '{{ ip_creation_task.scaleway_ip.id }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
organization: '{{ scaleway_organization }}'
|
||||
reverse: '{{ scaleway_reverse_name }}'
|
||||
register: ip_reverse_assignation_confirmation_task
|
||||
|
||||
- debug: var=ip_reverse_assignation_confirmation_task
|
||||
|
||||
- name: ip_reverse_assignation_confirmation_task is success
|
||||
assert:
|
||||
that:
|
||||
- ip_reverse_assignation_confirmation_task is success
|
||||
|
||||
- name: ip_reverse_assignation_confirmation_task is not changed
|
||||
assert:
|
||||
that:
|
||||
- ip_reverse_assignation_confirmation_task is not changed
|
||||
|
||||
- name: Create a server
|
||||
scaleway_compute:
|
||||
state: present
|
||||
name: '{{ scaleway_server_name }}'
|
||||
image: '{{ scaleway_image_id }}'
|
||||
organization: '{{ scaleway_organization }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
commercial_type: '{{ scaleway_commerial_type }}'
|
||||
dynamic_ip_required: false
|
||||
wait: true
|
||||
|
||||
register: server_creation_task
|
||||
|
||||
- debug: var=server_creation_task
|
||||
|
||||
- name: server_creation_task is success
|
||||
assert:
|
||||
that:
|
||||
- server_creation_task is success
|
||||
|
||||
- name: Assign IP to server (Check)
|
||||
check_mode: yes
|
||||
scaleway_ip:
|
||||
state: present
|
||||
id: '{{ ip_creation_task.scaleway_ip.id }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
organization: '{{ scaleway_organization }}'
|
||||
server: '{{ server_creation_task.msg.id }}'
|
||||
reverse: '{{ scaleway_reverse_name }}'
|
||||
register: ip_assignation_check_task
|
||||
|
||||
- debug: var=ip_assignation_check_task
|
||||
|
||||
- name: ip_assignation_check_task is success
|
||||
assert:
|
||||
that:
|
||||
- ip_assignation_check_task is success
|
||||
|
||||
- name: ip_assignation_check_task is success
|
||||
assert:
|
||||
that:
|
||||
- ip_assignation_check_task is success
|
||||
|
||||
- name: Assign IP to server
|
||||
scaleway_ip:
|
||||
state: present
|
||||
id: '{{ ip_creation_task.scaleway_ip.id }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
organization: '{{ scaleway_organization }}'
|
||||
server: '{{ server_creation_task.msg.id }}'
|
||||
reverse: '{{ scaleway_reverse_name }}'
|
||||
register: ip_assignation_task
|
||||
|
||||
- debug: var=ip_assignation_task
|
||||
|
||||
- name: ip_assignation_task is success
|
||||
assert:
|
||||
that:
|
||||
- ip_assignation_task is success
|
||||
|
||||
- name: ip_assignation_task is changed
|
||||
assert:
|
||||
that:
|
||||
- ip_assignation_task is changed
|
||||
|
||||
- name: Assign IP to server (Confirmation)
|
||||
scaleway_ip:
|
||||
state: present
|
||||
id: '{{ ip_creation_task.scaleway_ip.id }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
organization: '{{ scaleway_organization }}'
|
||||
server: '{{ server_creation_task.msg.id }}'
|
||||
reverse: '{{ scaleway_reverse_name }}'
|
||||
register: ip_assignation_confirmation_task
|
||||
|
||||
- debug: var=ip_assignation_confirmation_task
|
||||
|
||||
- name: ip_assignation_confirmation_task is success
|
||||
assert:
|
||||
that:
|
||||
- ip_assignation_confirmation_task is success
|
||||
|
||||
- name: ip_assignation_confirmation_task is not changed
|
||||
assert:
|
||||
that:
|
||||
- ip_assignation_confirmation_task is not changed
|
||||
|
||||
- name: Unassign IP to server (Check)
|
||||
check_mode: yes
|
||||
scaleway_ip:
|
||||
state: present
|
||||
id: '{{ ip_creation_task.scaleway_ip.id }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
organization: '{{ scaleway_organization }}'
|
||||
reverse: '{{ scaleway_reverse_name }}'
|
||||
register: ip_unassignation_check_task
|
||||
|
||||
- debug: var=ip_unassignation_check_task
|
||||
|
||||
- name: ip_unassignation_check_task is success
|
||||
assert:
|
||||
that:
|
||||
- ip_unassignation_check_task is success
|
||||
|
||||
- name: ip_unassignation_check_task is changed
|
||||
assert:
|
||||
that:
|
||||
- ip_unassignation_check_task is changed
|
||||
|
||||
- name: Unassign IP to server
|
||||
scaleway_ip:
|
||||
state: present
|
||||
id: '{{ ip_creation_task.scaleway_ip.id }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
organization: '{{ scaleway_organization }}'
|
||||
reverse: '{{ scaleway_reverse_name }}'
|
||||
register: ip_unassignation_task
|
||||
|
||||
- debug: var=ip_unassignation_task
|
||||
|
||||
- name: ip_unassignation_task is success
|
||||
assert:
|
||||
that:
|
||||
- ip_unassignation_task is success
|
||||
|
||||
- name: ip_unassignation_task is changed
|
||||
assert:
|
||||
that:
|
||||
- ip_unassignation_task is changed
|
||||
|
||||
- name: ip_unassignation_task.scaleway_ip.server is none
|
||||
assert:
|
||||
that:
|
||||
- '{{ ip_unassignation_task.scaleway_ip.server is none }}'
|
||||
|
||||
- name: Unassign IP to server (Confirmation)
|
||||
scaleway_ip:
|
||||
state: present
|
||||
id: '{{ ip_creation_task.scaleway_ip.id }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
organization: '{{ scaleway_organization }}'
|
||||
reverse: '{{ scaleway_reverse_name }}'
|
||||
register: ip_unassignation_confirmation_task
|
||||
|
||||
- debug: var=ip_unassignation_confirmation_task
|
||||
|
||||
- name: ip_unassignation_confirmation_task is success
|
||||
assert:
|
||||
that:
|
||||
- ip_unassignation_confirmation_task is success
|
||||
|
||||
- name: ip_unassignation_confirmation_task is not changed
|
||||
assert:
|
||||
that:
|
||||
- ip_unassignation_confirmation_task is not changed
|
||||
|
||||
- name: ip_unassignation_confirmation_task.scaleway_ip.server is none
|
||||
assert:
|
||||
that:
|
||||
- '{{ ip_unassignation_task.scaleway_ip.server is none }}'
|
||||
|
||||
- name: Unassign reverse to IP (Check)
|
||||
check_mode: yes
|
||||
scaleway_ip:
|
||||
state: present
|
||||
id: '{{ ip_creation_task.scaleway_ip.id }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
organization: '{{ scaleway_organization }}'
|
||||
register: ip_reverse_unassignation_check_task
|
||||
|
||||
- debug: var=ip_reverse_unassignation_check_task
|
||||
|
||||
- name: ip_reverse_unassignation_check_task is success
|
||||
assert:
|
||||
that:
|
||||
- ip_reverse_unassignation_check_task is success
|
||||
|
||||
- name: ip_reverse_unassignation_check_task is changed
|
||||
assert:
|
||||
that:
|
||||
- ip_reverse_unassignation_check_task is changed
|
||||
|
||||
- name: Unassign reverse to an IP
|
||||
scaleway_ip:
|
||||
state: present
|
||||
id: '{{ ip_creation_task.scaleway_ip.id }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
organization: '{{ scaleway_organization }}'
|
||||
register: ip_reverse_unassignation_task
|
||||
|
||||
- debug: var=ip_reverse_unassignation_task
|
||||
|
||||
- name: ip_reverse_unassignation_task is success
|
||||
assert:
|
||||
that:
|
||||
- ip_reverse_unassignation_task is success
|
||||
|
||||
- name: ip_reverse_unassignation_task is changed
|
||||
assert:
|
||||
that:
|
||||
- ip_reverse_unassignation_task is changed
|
||||
|
||||
- name: ip_reverse_unassignation_task.scaleway_ip.reverse is none
|
||||
assert:
|
||||
that:
|
||||
- '{{ ip_reverse_unassignation_task.scaleway_ip.reverse is none }}'
|
||||
|
||||
- name: Unassign reverse to an IP (Confirmation)
|
||||
scaleway_ip:
|
||||
state: present
|
||||
id: '{{ ip_creation_task.scaleway_ip.id }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
organization: '{{ scaleway_organization }}'
|
||||
register: ip_reverse_unassignation_confirmation_task
|
||||
|
||||
- debug: var=ip_reverse_unassignation_confirmation_task
|
||||
|
||||
- name: ip_reverse_unassignation_confirmation_task is success
|
||||
assert:
|
||||
that:
|
||||
- ip_reverse_unassignation_confirmation_task is success
|
||||
|
||||
- name: ip_reverse_unassignation_confirmation_task is not changed
|
||||
assert:
|
||||
that:
|
||||
- ip_reverse_unassignation_confirmation_task is not changed
|
||||
|
||||
- name: ip_reverse_unassignation_confirmation_task.scaleway_ip.server is none
|
||||
assert:
|
||||
that:
|
||||
- '{{ ip_reverse_unassignation_confirmation_task.scaleway_ip.reverse is none }}'
|
||||
|
||||
- name: Destroy a server
|
||||
scaleway_compute:
|
||||
name: '{{ scaleway_server_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
|
||||
|
||||
- name: server_destroy_task is success
|
||||
assert:
|
||||
that:
|
||||
- server_destroy_task is success
|
||||
|
||||
- name: server_destroy_task is changed
|
||||
assert:
|
||||
that:
|
||||
- server_destroy_task is changed
|
||||
|
||||
- name: Delete IP (Check)
|
||||
check_mode: yes
|
||||
scaleway_ip:
|
||||
state: absent
|
||||
region: '{{ scaleway_region }}'
|
||||
id: '{{ ip_creation_task.scaleway_ip.id }}'
|
||||
register: ip_deletion_check_task
|
||||
|
||||
- name: ip_deletion_check_task is success
|
||||
assert:
|
||||
that:
|
||||
- ip_deletion_check_task is success
|
||||
|
||||
- name: ip_deletion_check_task is changed
|
||||
assert:
|
||||
that:
|
||||
- ip_deletion_check_task is changed
|
||||
|
||||
- name: Delete IP
|
||||
scaleway_ip:
|
||||
state: absent
|
||||
region: '{{ scaleway_region }}'
|
||||
id: '{{ ip_creation_task.scaleway_ip.id }}'
|
||||
register: ip_deletion_task
|
||||
|
||||
- name: ip_deletion_task is success
|
||||
assert:
|
||||
that:
|
||||
- ip_deletion_task is success
|
||||
|
||||
- name: ip_deletion_task is changed
|
||||
assert:
|
||||
that:
|
||||
- ip_deletion_task is changed
|
||||
|
||||
- name: Delete IP (Confirmation)
|
||||
scaleway_ip:
|
||||
state: absent
|
||||
region: '{{ scaleway_region }}'
|
||||
id: '{{ ip_creation_task.scaleway_ip.id }}'
|
||||
register: ip_deletion_confirmation_task
|
||||
|
||||
- name: ip_deletion_confirmation_task is success
|
||||
assert:
|
||||
that:
|
||||
- ip_deletion_confirmation_task is success
|
||||
|
||||
- name: ip_deletion_confirmation_task is not changed
|
||||
assert:
|
||||
that:
|
||||
- ip_deletion_confirmation_task is not changed
|
||||
2
test/integration/targets/scaleway_ip_facts/aliases
Normal file
2
test/integration/targets/scaleway_ip_facts/aliases
Normal file
@@ -0,0 +1,2 @@
|
||||
cloud/scaleway
|
||||
unsupported
|
||||
29
test/integration/targets/scaleway_ip_facts/tasks/main.yml
Normal file
29
test/integration/targets/scaleway_ip_facts/tasks/main.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
# SCW_API_KEY='XXX' ansible-playbook ./test/legacy/scaleway.yml --tags test_scaleway_ip_facts
|
||||
|
||||
- name: Get ip informations and register it in a variable
|
||||
scaleway_ip_facts:
|
||||
region: par1
|
||||
register: ips
|
||||
|
||||
- name: Display ips variable
|
||||
debug:
|
||||
var: ips
|
||||
|
||||
- name: Ensure retrieval of ips facts is success
|
||||
assert:
|
||||
that:
|
||||
- ips is success
|
||||
|
||||
- name: Get ip informations and register it in a variable
|
||||
scaleway_ip_facts:
|
||||
region: ams1
|
||||
register: ips_ams1
|
||||
|
||||
- name: Display ips variable
|
||||
debug:
|
||||
var: ips_ams1
|
||||
|
||||
- name: Ensure retrieval of ips facts is success
|
||||
assert:
|
||||
that:
|
||||
- ips_ams1 is success
|
||||
2
test/integration/targets/scaleway_lb/aliases
Normal file
2
test/integration/targets/scaleway_lb/aliases
Normal file
@@ -0,0 +1,2 @@
|
||||
cloud/scaleway
|
||||
unsupported
|
||||
8
test/integration/targets/scaleway_lb/defaults/main.yml
Normal file
8
test/integration/targets/scaleway_lb/defaults/main.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
scaleway_region: fr-par
|
||||
name: lb_ansible_test
|
||||
description: Load-balancer used for testing scaleway_lb ansible module
|
||||
updated_description: Load-balancer used for testing scaleway_lb ansible module (Updated description)
|
||||
tags:
|
||||
- first_tag
|
||||
- second_tag
|
||||
216
test/integration/targets/scaleway_lb/tasks/main.yml
Normal file
216
test/integration/targets/scaleway_lb/tasks/main.yml
Normal file
@@ -0,0 +1,216 @@
|
||||
# SCW_API_KEY='XXX' SCW_ORG='YYY' ansible-playbook ./test/legacy/scaleway.yml --tags test_scaleway_lb
|
||||
|
||||
- name: Create a load-balancer (Check)
|
||||
check_mode: yes
|
||||
scaleway_lb:
|
||||
state: present
|
||||
name: '{{ name }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
organization_id: '{{ scw_org }}'
|
||||
description: '{{ description }}'
|
||||
tags: '{{ tags }}'
|
||||
register: lb_creation_check_task
|
||||
|
||||
- debug: var=lb_creation_check_task
|
||||
|
||||
- name: lb_creation_check_task is success
|
||||
assert:
|
||||
that:
|
||||
- lb_creation_check_task is success
|
||||
|
||||
- name: lb_creation_check_task is changed
|
||||
assert:
|
||||
that:
|
||||
- lb_creation_check_task is changed
|
||||
|
||||
- name: Create load-balancer
|
||||
scaleway_lb:
|
||||
state: present
|
||||
name: '{{ name }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
organization_id: '{{ scw_org }}'
|
||||
description: '{{ description }}'
|
||||
tags: '{{ tags }}'
|
||||
wait: true
|
||||
register: lb_creation_task
|
||||
|
||||
- debug: var=lb_creation_task
|
||||
|
||||
- name: lb_creation_task is success
|
||||
assert:
|
||||
that:
|
||||
- lb_creation_task is success
|
||||
|
||||
- name: lb_creation_task is changed
|
||||
assert:
|
||||
that:
|
||||
- lb_creation_task is changed
|
||||
|
||||
- name: Assert that the load-balancer is in a valid state
|
||||
assert:
|
||||
that:
|
||||
- lb_creation_task.scaleway_lb.status == "ready"
|
||||
|
||||
- name: Create load-balancer (Confirmation)
|
||||
scaleway_lb:
|
||||
state: present
|
||||
name: '{{ name }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
organization_id: '{{ scw_org }}'
|
||||
tags: '{{ tags }}'
|
||||
description: '{{ description }}'
|
||||
register: lb_creation_confirmation_task
|
||||
|
||||
- debug: var=lb_creation_confirmation_task
|
||||
|
||||
- name: lb_creation_confirmation_task is success
|
||||
assert:
|
||||
that:
|
||||
- lb_creation_confirmation_task is success
|
||||
|
||||
- name: lb_creation_confirmation_task is not changed
|
||||
assert:
|
||||
that:
|
||||
- lb_creation_confirmation_task is not changed
|
||||
|
||||
- name: Assert that the load-balancer is in a valid state
|
||||
assert:
|
||||
that:
|
||||
- lb_creation_confirmation_task.scaleway_lb.status == "ready"
|
||||
|
||||
- name: Update load-balancer (Check)
|
||||
check_mode: yes
|
||||
scaleway_lb:
|
||||
state: present
|
||||
name: '{{ name }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
organization_id: '{{ scw_org }}'
|
||||
tags: '{{ tags }}'
|
||||
description: '{{ updated_description }}'
|
||||
register: lb_update_check_task
|
||||
|
||||
- debug: var=lb_update_check_task
|
||||
|
||||
- name: lb_update_check_task is success
|
||||
assert:
|
||||
that:
|
||||
- lb_update_check_task is success
|
||||
|
||||
- name: lb_update_check_task is changed
|
||||
assert:
|
||||
that:
|
||||
- lb_update_check_task is changed
|
||||
|
||||
- name: Update load-balancer
|
||||
scaleway_lb:
|
||||
state: present
|
||||
name: '{{ name }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
tags: '{{ tags }}'
|
||||
organization_id: '{{ scw_org }}'
|
||||
description: '{{ updated_description }}'
|
||||
wait: true
|
||||
register: lb_update_task
|
||||
|
||||
- debug: var=lb_update_task
|
||||
|
||||
- name: lb_update_task is success
|
||||
assert:
|
||||
that:
|
||||
- lb_update_task is success
|
||||
|
||||
- name: lb_update_task is changed
|
||||
assert:
|
||||
that:
|
||||
- lb_update_task is changed
|
||||
|
||||
- name: Assert that the load-balancer is in a valid state
|
||||
assert:
|
||||
that:
|
||||
- lb_update_task.scaleway_lb.status == "ready"
|
||||
|
||||
- name: Update load-balancer (Confirmation)
|
||||
scaleway_lb:
|
||||
state: present
|
||||
name: '{{ name }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
tags: '{{ tags }}'
|
||||
organization_id: '{{ scw_org }}'
|
||||
description: '{{ updated_description }}'
|
||||
register: lb_update_confirmation_task
|
||||
|
||||
- debug: var=lb_update_confirmation_task
|
||||
|
||||
- name: lb_update_confirmation_task is success
|
||||
assert:
|
||||
that:
|
||||
- lb_update_confirmation_task is success
|
||||
|
||||
- name: lb_update_confirmation_task is not changed
|
||||
assert:
|
||||
that:
|
||||
- lb_update_confirmation_task is not changed
|
||||
|
||||
- name: Assert that the load-balancer is in a valid state
|
||||
assert:
|
||||
that:
|
||||
- lb_update_confirmation_task.scaleway_lb.status == "ready"
|
||||
|
||||
- name: Delete load-balancer (Check)
|
||||
check_mode: yes
|
||||
scaleway_lb:
|
||||
state: absent
|
||||
name: '{{ name }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
description: '{{ description }}'
|
||||
organization_id: '{{ scw_org }}'
|
||||
register: lb_deletion_check_task
|
||||
|
||||
- name: lb_deletion_check_task is success
|
||||
assert:
|
||||
that:
|
||||
- lb_deletion_check_task is success
|
||||
|
||||
- name: lb_deletion_check_task is changed
|
||||
assert:
|
||||
that:
|
||||
- lb_deletion_check_task is changed
|
||||
|
||||
- name: Delete load-balancer
|
||||
scaleway_lb:
|
||||
state: absent
|
||||
name: '{{ name }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
description: '{{ description }}'
|
||||
organization_id: '{{ scw_org }}'
|
||||
wait: true
|
||||
register: lb_deletion_task
|
||||
|
||||
- name: lb_deletion_task is success
|
||||
assert:
|
||||
that:
|
||||
- lb_deletion_task is success
|
||||
|
||||
- name: lb_deletion_task is changed
|
||||
assert:
|
||||
that:
|
||||
- lb_deletion_task is changed
|
||||
|
||||
- name: Delete load-balancer (Confirmation)
|
||||
scaleway_lb:
|
||||
state: absent
|
||||
name: '{{ name }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
description: '{{ description }}'
|
||||
organization_id: '{{ scw_org }}'
|
||||
register: lb_deletion_confirmation_task
|
||||
|
||||
- name: lb_deletion_confirmation_task is success
|
||||
assert:
|
||||
that:
|
||||
- lb_deletion_confirmation_task is success
|
||||
|
||||
- name: lb_deletion_confirmation_task is not changed
|
||||
assert:
|
||||
that:
|
||||
- lb_deletion_confirmation_task is not changed
|
||||
@@ -0,0 +1,2 @@
|
||||
cloud/scaleway
|
||||
unsupported
|
||||
@@ -0,0 +1,12 @@
|
||||
- name: Get organization informations and register it in a variable
|
||||
scaleway_organization_facts:
|
||||
register: organizations
|
||||
|
||||
- name: Display organizations variable
|
||||
debug:
|
||||
var: organizations
|
||||
|
||||
- name: Ensure retrieval of organizations facts is success
|
||||
assert:
|
||||
that:
|
||||
- organizations is success
|
||||
2
test/integration/targets/scaleway_s3/aliases
Normal file
2
test/integration/targets/scaleway_s3/aliases
Normal file
@@ -0,0 +1,2 @@
|
||||
cloud/scaleway
|
||||
unsupported
|
||||
4
test/integration/targets/scaleway_s3/defaults/main.yml
Normal file
4
test/integration/targets/scaleway_s3/defaults/main.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
scaleway_region: nl-ams
|
||||
endpoint: s3.nl-ams.scw.cloud
|
||||
s3_url: https://s3.nl-ams.scw.cloud
|
||||
19
test/integration/targets/scaleway_s3/tasks/aws_s3.yml
Normal file
19
test/integration/targets/scaleway_s3/tasks/aws_s3.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
- name: Create a local file
|
||||
tempfile:
|
||||
state: file
|
||||
suffix: temp
|
||||
delegate_to: localhost
|
||||
register: tempfile
|
||||
|
||||
- import_tasks: aws_s3_create.yml
|
||||
|
||||
- import_tasks: aws_s3_put.yml
|
||||
- import_tasks: aws_s3_get.yml
|
||||
|
||||
- import_tasks: aws_s3_getstr.yml
|
||||
- import_tasks: aws_s3_geturl.yml
|
||||
- import_tasks: aws_s3_list.yml
|
||||
|
||||
- import_tasks: aws_s3_delobj.yml
|
||||
|
||||
- import_tasks: aws_s3_delete.yml
|
||||
69
test/integration/targets/scaleway_s3/tasks/aws_s3_create.yml
Normal file
69
test/integration/targets/scaleway_s3/tasks/aws_s3_create.yml
Normal file
@@ -0,0 +1,69 @@
|
||||
- name: Create s3 bucket (Check)
|
||||
check_mode: yes
|
||||
aws_s3:
|
||||
bucket: '{{ bucket_name }}'
|
||||
mode: create
|
||||
region: '{{ scaleway_region }}'
|
||||
s3_url: '{{ s3_url }}'
|
||||
encrypt: false
|
||||
register: bucket_creation_check
|
||||
|
||||
- name: Show bucket_creation_check
|
||||
debug:
|
||||
var: bucket_creation_check
|
||||
|
||||
- name: bucket_creation_check is success
|
||||
assert:
|
||||
that:
|
||||
- bucket_creation_check is success
|
||||
|
||||
- name: bucket_creation_check is changed
|
||||
assert:
|
||||
that:
|
||||
- bucket_creation_check is changed
|
||||
|
||||
- name: Create s3 bucket
|
||||
aws_s3:
|
||||
bucket: '{{ bucket_name }}'
|
||||
mode: create
|
||||
region: '{{ scaleway_region }}'
|
||||
s3_url: '{{ s3_url }}'
|
||||
encrypt: false
|
||||
register: bucket_creation
|
||||
|
||||
- name: Show bucket_creation
|
||||
debug:
|
||||
var: bucket_creation
|
||||
|
||||
- name: bucket_creation is success
|
||||
assert:
|
||||
that:
|
||||
- bucket_creation is success
|
||||
|
||||
- name: bucket_creation is changed
|
||||
assert:
|
||||
that:
|
||||
- bucket_creation is changed
|
||||
|
||||
- name: Create s3 bucket (Confirmation)
|
||||
aws_s3:
|
||||
bucket: '{{ bucket_name }}'
|
||||
mode: create
|
||||
region: '{{ scaleway_region }}'
|
||||
s3_url: '{{ s3_url }}'
|
||||
encrypt: false
|
||||
register: bucket_creation_confirmation
|
||||
|
||||
- name: Show bucket_creation_confirmation
|
||||
debug:
|
||||
var: bucket_creation_confirmation
|
||||
|
||||
- name: bucket_creation_confirmation is success
|
||||
assert:
|
||||
that:
|
||||
- bucket_creation_confirmation is success
|
||||
|
||||
- name: bucket_creation_confirmation is not changed
|
||||
assert:
|
||||
that:
|
||||
- bucket_creation_confirmation is not changed
|
||||
69
test/integration/targets/scaleway_s3/tasks/aws_s3_delete.yml
Normal file
69
test/integration/targets/scaleway_s3/tasks/aws_s3_delete.yml
Normal file
@@ -0,0 +1,69 @@
|
||||
- name: Delete s3 bucket (Check)
|
||||
check_mode: yes
|
||||
aws_s3:
|
||||
bucket: '{{ bucket_name }}'
|
||||
mode: delete
|
||||
region: '{{ scaleway_region }}'
|
||||
s3_url: '{{ s3_url }}'
|
||||
encrypt: false
|
||||
register: bucket_deletion_check
|
||||
|
||||
- name: Show bucket_deletion_check
|
||||
debug:
|
||||
var: bucket_deletion_check
|
||||
|
||||
- name: bucket_deletion_check is success
|
||||
assert:
|
||||
that:
|
||||
- bucket_deletion_check is success
|
||||
|
||||
- name: bucket_deletion_check is changed
|
||||
assert:
|
||||
that:
|
||||
- bucket_deletion_check is changed
|
||||
|
||||
- name: Delete s3 bucket
|
||||
aws_s3:
|
||||
bucket: '{{ bucket_name }}'
|
||||
mode: delete
|
||||
region: '{{ scaleway_region }}'
|
||||
s3_url: '{{ s3_url }}'
|
||||
encrypt: false
|
||||
register: bucket_creation
|
||||
|
||||
- name: Show bucket_creation
|
||||
debug:
|
||||
var: bucket_creation
|
||||
|
||||
- name: bucket_creation is success
|
||||
assert:
|
||||
that:
|
||||
- bucket_creation is success
|
||||
|
||||
- name: bucket_creation is changed
|
||||
assert:
|
||||
that:
|
||||
- bucket_creation is changed
|
||||
|
||||
- name: Delete s3 bucket (Confirmation)
|
||||
aws_s3:
|
||||
bucket: '{{ bucket_name }}'
|
||||
mode: delete
|
||||
region: '{{ scaleway_region }}'
|
||||
s3_url: '{{ s3_url }}'
|
||||
encrypt: false
|
||||
register: bucket_creation_confirmation
|
||||
|
||||
- name: Show bucket_creation_confirmation
|
||||
debug:
|
||||
var: bucket_creation_confirmation
|
||||
|
||||
- name: bucket_creation_confirmation is success
|
||||
assert:
|
||||
that:
|
||||
- bucket_creation_confirmation is success
|
||||
|
||||
- name: bucket_creation_confirmation is not changed
|
||||
assert:
|
||||
that:
|
||||
- bucket_creation_confirmation is not changed
|
||||
73
test/integration/targets/scaleway_s3/tasks/aws_s3_delobj.yml
Normal file
73
test/integration/targets/scaleway_s3/tasks/aws_s3_delobj.yml
Normal file
@@ -0,0 +1,73 @@
|
||||
- name: Delete an object (Check)
|
||||
check_mode: yes
|
||||
aws_s3:
|
||||
mode: delobj
|
||||
bucket: '{{ bucket_name }}'
|
||||
s3_url: '{{ s3_url }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
object: test.txt
|
||||
encrypt: false
|
||||
register: delobj_check_task
|
||||
|
||||
- name: Show delobj_check_task
|
||||
debug:
|
||||
var: delobj_check_task
|
||||
|
||||
- name: delobj_check_task is success
|
||||
assert:
|
||||
that:
|
||||
- delobj_check_task is success
|
||||
|
||||
- name: delobj_check_task is changed
|
||||
assert:
|
||||
that:
|
||||
- delobj_check_task is changed
|
||||
|
||||
- name: Delete an object
|
||||
aws_s3:
|
||||
mode: delobj
|
||||
bucket: '{{ bucket_name }}'
|
||||
s3_url: '{{ s3_url }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
object: test.txt
|
||||
encrypt: false
|
||||
register: delobj_task
|
||||
|
||||
- name: Show delobj_task
|
||||
debug:
|
||||
var: delobj_task
|
||||
|
||||
- name: delobj_task is success
|
||||
assert:
|
||||
that:
|
||||
- delobj_task is success
|
||||
|
||||
- name: delobj_task is changed
|
||||
assert:
|
||||
that:
|
||||
- delobj_task is changed
|
||||
|
||||
|
||||
- name: Delete an object (Confirmation)
|
||||
aws_s3:
|
||||
mode: delobj
|
||||
bucket: '{{ bucket_name }}'
|
||||
s3_url: '{{ s3_url }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
object: test.txt
|
||||
encrypt: false
|
||||
register: delobj_confirmation_task
|
||||
|
||||
- name: Show delobj_confirmation_task
|
||||
debug:
|
||||
var: delobj_confirmation_task
|
||||
|
||||
- name: delobj_confirmation_task is success
|
||||
assert:
|
||||
that:
|
||||
- delobj_confirmation_task is success
|
||||
|
||||
- name: delobj_confirmation_task is changed
|
||||
assert:
|
||||
that:
|
||||
- delobj_confirmation_task is changed
|
||||
31
test/integration/targets/scaleway_s3/tasks/aws_s3_get.yml
Normal file
31
test/integration/targets/scaleway_s3/tasks/aws_s3_get.yml
Normal file
@@ -0,0 +1,31 @@
|
||||
- name: Create a destination local file
|
||||
tempfile:
|
||||
state: file
|
||||
suffix: temp
|
||||
delegate_to: localhost
|
||||
register: tempfile_dst
|
||||
|
||||
- name: Get from bucket
|
||||
aws_s3:
|
||||
mode: get
|
||||
bucket: '{{ bucket_name }}'
|
||||
s3_url: '{{ s3_url }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
object: test.txt
|
||||
dest: '{{ tempfile_dst.path }}'
|
||||
encrypt: false
|
||||
register: get_task
|
||||
|
||||
- name: Show get_task
|
||||
debug:
|
||||
var: get_task
|
||||
|
||||
- name: get_task is success
|
||||
assert:
|
||||
that:
|
||||
- get_task is success
|
||||
|
||||
- name: get_task is changed
|
||||
assert:
|
||||
that:
|
||||
- get_task is changed
|
||||
23
test/integration/targets/scaleway_s3/tasks/aws_s3_getstr.yml
Normal file
23
test/integration/targets/scaleway_s3/tasks/aws_s3_getstr.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
- name: Get str from bucket
|
||||
aws_s3:
|
||||
mode: getstr
|
||||
bucket: '{{ bucket_name }}'
|
||||
s3_url: '{{ s3_url }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
encrypt: false
|
||||
object: test.txt
|
||||
register: getstr_task
|
||||
|
||||
- name: Show getstr_task
|
||||
debug:
|
||||
var: getstr_task
|
||||
|
||||
- name: getstr_task is success
|
||||
assert:
|
||||
that:
|
||||
- getstr_task is success
|
||||
|
||||
- name: getstr_task is changed
|
||||
assert:
|
||||
that:
|
||||
- getstr_task is changed
|
||||
23
test/integration/targets/scaleway_s3/tasks/aws_s3_geturl.yml
Normal file
23
test/integration/targets/scaleway_s3/tasks/aws_s3_geturl.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
- name: Get url from bucket
|
||||
aws_s3:
|
||||
mode: geturl
|
||||
bucket: '{{ bucket_name }}'
|
||||
s3_url: '{{ s3_url }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
object: test.txt
|
||||
encrypt: false
|
||||
register: geturl_task
|
||||
|
||||
- name: Show geturl_task
|
||||
debug:
|
||||
var: geturl_task
|
||||
|
||||
- name: geturl_task is success
|
||||
assert:
|
||||
that:
|
||||
- geturl_task is success
|
||||
|
||||
- name: geturl_task is changed
|
||||
assert:
|
||||
that:
|
||||
- geturl_task is changed
|
||||
22
test/integration/targets/scaleway_s3/tasks/aws_s3_list.yml
Normal file
22
test/integration/targets/scaleway_s3/tasks/aws_s3_list.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
- name: List bucket
|
||||
aws_s3:
|
||||
mode: list
|
||||
bucket: '{{ bucket_name }}'
|
||||
s3_url: '{{ s3_url }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
encrypt: false
|
||||
register: list_task
|
||||
|
||||
- name: Show list_task
|
||||
debug:
|
||||
var: list_task
|
||||
|
||||
- name: list_task is success
|
||||
assert:
|
||||
that:
|
||||
- list_task is success
|
||||
|
||||
- name: list_task is not changed
|
||||
assert:
|
||||
that:
|
||||
- list_task is not changed
|
||||
50
test/integration/targets/scaleway_s3/tasks/aws_s3_put.yml
Normal file
50
test/integration/targets/scaleway_s3/tasks/aws_s3_put.yml
Normal file
@@ -0,0 +1,50 @@
|
||||
- name: Put an object (Check)
|
||||
check_mode: yes
|
||||
aws_s3:
|
||||
mode: put
|
||||
bucket: '{{ bucket_name }}'
|
||||
s3_url: '{{ s3_url }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
src: '{{ tempfile.path }}'
|
||||
object: test.txt
|
||||
encrypt: false
|
||||
register: put_check_task
|
||||
|
||||
- name: Show put_check_task
|
||||
debug:
|
||||
var: put_check_task
|
||||
|
||||
- name: put_check_task is success
|
||||
assert:
|
||||
that:
|
||||
- put_check_task is success
|
||||
|
||||
- name: put_check_task is changed
|
||||
assert:
|
||||
that:
|
||||
- put_check_task is changed
|
||||
|
||||
- name: Put an object
|
||||
aws_s3:
|
||||
mode: put
|
||||
bucket: '{{ bucket_name }}'
|
||||
s3_url: '{{ s3_url }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
src: '{{ tempfile.path }}'
|
||||
object: test.txt
|
||||
encrypt: false
|
||||
register: put_task
|
||||
|
||||
- name: Show put_task
|
||||
debug:
|
||||
var: put_task
|
||||
|
||||
- name: put_task is success
|
||||
assert:
|
||||
that:
|
||||
- put_task is success
|
||||
|
||||
- name: put_task is changed
|
||||
assert:
|
||||
that:
|
||||
- put_task is changed
|
||||
12
test/integration/targets/scaleway_s3/tasks/main.yml
Normal file
12
test/integration/targets/scaleway_s3/tasks/main.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
# AWS_ACCESS_KEY='XXX' AWS_SECRET_KEY='YYY' ansible-playbook ./test/legacy/scaleway.yml --tags test_scaleway_s3
|
||||
|
||||
# use a fact instead of a variable, otherwise template is evaluate each time variable is used
|
||||
- set_fact:
|
||||
bucket_name: "ansible-s3-test-{{ 99999999 | random | to_uuid }}"
|
||||
|
||||
- name: Show bucket name
|
||||
debug:
|
||||
var: bucket_name
|
||||
|
||||
- import_tasks: s3_bucket.yml
|
||||
- import_tasks: aws_s3.yml
|
||||
90
test/integration/targets/scaleway_s3/tasks/s3_bucket.yml
Normal file
90
test/integration/targets/scaleway_s3/tasks/s3_bucket.yml
Normal file
@@ -0,0 +1,90 @@
|
||||
- name: Bucket Creation
|
||||
s3_bucket:
|
||||
name: '{{ bucket_name }}'
|
||||
s3_url: '{{ s3_url }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
|
||||
requester_pays:
|
||||
register: bucket_creation_task
|
||||
|
||||
- name: Show bucket_creation_task
|
||||
debug:
|
||||
var: bucket_creation_task
|
||||
|
||||
- name: bucket_creation_task is success
|
||||
assert:
|
||||
that:
|
||||
- bucket_creation_task is success
|
||||
|
||||
- name: bucket_creation_task is changed
|
||||
assert:
|
||||
that:
|
||||
- bucket_creation_task is changed
|
||||
|
||||
- name: Bucket Creation (Confirmation)
|
||||
s3_bucket:
|
||||
name: '{{ bucket_name }}'
|
||||
s3_url: '{{ s3_url }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
requester_pays: null
|
||||
register: bucket_creation_confirmation_task
|
||||
|
||||
- name: Show bucket_creation_confirmation_task
|
||||
debug:
|
||||
var: bucket_creation_confirmation_task
|
||||
|
||||
- name: bucket_creation_confirmation_task is success
|
||||
assert:
|
||||
that:
|
||||
- bucket_creation_confirmation_task is success
|
||||
|
||||
- name: bucket_creation_confirmation_task is not changed
|
||||
assert:
|
||||
that:
|
||||
- bucket_creation_confirmation_task is not changed
|
||||
|
||||
- name: Bucket Deletion
|
||||
s3_bucket:
|
||||
name: '{{ bucket_name }}'
|
||||
s3_url: '{{ s3_url }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
requester_pays: null
|
||||
state: absent
|
||||
register: bucket_deletion_task
|
||||
|
||||
- name: Show bucket_deletion_task
|
||||
debug:
|
||||
var: bucket_deletion_task
|
||||
|
||||
- name: bucket_deletion_task is success
|
||||
assert:
|
||||
that:
|
||||
- bucket_deletion_task is success
|
||||
|
||||
- name: bucket_deletion_task is changed
|
||||
assert:
|
||||
that:
|
||||
- bucket_deletion_task is changed
|
||||
|
||||
- name: Bucket Deletion (Confirmation)
|
||||
s3_bucket:
|
||||
name: '{{ bucket_name }}'
|
||||
s3_url: '{{ s3_url }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
requester_pays: null
|
||||
state: absent
|
||||
register: bucket_deletion_confirmation_task
|
||||
|
||||
- name: Show bucket_deletion_confirmation_task
|
||||
debug:
|
||||
var: bucket_deletion_confirmation_task
|
||||
|
||||
- name: bucket_deletion_confirmation_task is success
|
||||
assert:
|
||||
that:
|
||||
- bucket_deletion_confirmation_task is success
|
||||
|
||||
- name: bucket_deletion_confirmation_task is not changed
|
||||
assert:
|
||||
that:
|
||||
- bucket_deletion_confirmation_task is not changed
|
||||
2
test/integration/targets/scaleway_security_group/aliases
Normal file
2
test/integration/targets/scaleway_security_group/aliases
Normal file
@@ -0,0 +1,2 @@
|
||||
cloud/scaleway
|
||||
unsupported
|
||||
@@ -0,0 +1,3 @@
|
||||
---
|
||||
scaleway_organization: '{{ scw_org }}'
|
||||
scaleway_region: ams1
|
||||
129
test/integration/targets/scaleway_security_group/tasks/main.yml
Normal file
129
test/integration/targets/scaleway_security_group/tasks/main.yml
Normal file
@@ -0,0 +1,129 @@
|
||||
- name: Create security group check
|
||||
check_mode: yes
|
||||
scaleway_security_group:
|
||||
state: present
|
||||
region: '{{ scaleway_region }}'
|
||||
name: security_group
|
||||
description: 'my security group description'
|
||||
organization: '{{ scaleway_organization }}'
|
||||
stateful: false
|
||||
inbound_default_policy: accept
|
||||
outbound_default_policy: accept
|
||||
organization_default: false
|
||||
register: security_group_creation
|
||||
|
||||
- debug: var=security_group_creation
|
||||
|
||||
- name: Ensure security groups check facts is success
|
||||
assert:
|
||||
that:
|
||||
- security_group_creation is success
|
||||
- security_group_creation is changed
|
||||
|
||||
- block:
|
||||
- name: Create security group
|
||||
scaleway_security_group:
|
||||
state: present
|
||||
region: '{{ scaleway_region }}'
|
||||
name: security_group
|
||||
description: 'my security group description'
|
||||
organization: '{{ scaleway_organization }}'
|
||||
stateful: false
|
||||
inbound_default_policy: accept
|
||||
outbound_default_policy: accept
|
||||
organization_default: false
|
||||
register: security_group_creation
|
||||
|
||||
- debug: var=security_group_creation
|
||||
|
||||
- name: Ensure security groups facts is success
|
||||
assert:
|
||||
that:
|
||||
- security_group_creation is success
|
||||
- security_group_creation is changed
|
||||
|
||||
- name: Create security group duplicate
|
||||
scaleway_security_group:
|
||||
state: present
|
||||
region: '{{ scaleway_region }}'
|
||||
name: security_group
|
||||
description: 'my security group description'
|
||||
organization: '{{ scaleway_organization }}'
|
||||
stateful: false
|
||||
inbound_default_policy: accept
|
||||
outbound_default_policy: accept
|
||||
organization_default: false
|
||||
register: security_group_creation
|
||||
|
||||
- debug: var=security_group_creation
|
||||
|
||||
- name: Ensure security groups duplicate facts is success
|
||||
assert:
|
||||
that:
|
||||
- security_group_creation is success
|
||||
- security_group_creation is not changed
|
||||
|
||||
- name: Delete security group check
|
||||
check_mode: yes
|
||||
scaleway_security_group:
|
||||
state: absent
|
||||
region: '{{ scaleway_region }}'
|
||||
name: security_group
|
||||
description: 'my security group description'
|
||||
organization: '{{ scaleway_organization }}'
|
||||
stateful: false
|
||||
inbound_default_policy: accept
|
||||
outbound_default_policy: accept
|
||||
organization_default: false
|
||||
register: security_group_deletion
|
||||
|
||||
- debug: var=security_group_deletion
|
||||
|
||||
- name: Ensure security groups delete check facts is success
|
||||
assert:
|
||||
that:
|
||||
- security_group_deletion is success
|
||||
- security_group_deletion is changed
|
||||
|
||||
always:
|
||||
- name: Delete security group
|
||||
scaleway_security_group:
|
||||
state: absent
|
||||
region: '{{ scaleway_region }}'
|
||||
name: security_group
|
||||
description: 'my security group description'
|
||||
organization: '{{ scaleway_organization }}'
|
||||
stateful: false
|
||||
inbound_default_policy: accept
|
||||
outbound_default_policy: accept
|
||||
organization_default: false
|
||||
register: security_group_deletion
|
||||
|
||||
- debug: var=security_group_deletion
|
||||
|
||||
- name: Ensure security groups delete facts is success
|
||||
assert:
|
||||
that:
|
||||
- security_group_deletion is success
|
||||
- security_group_deletion is changed
|
||||
|
||||
- name: Delete security group duplicate
|
||||
scaleway_security_group:
|
||||
state: absent
|
||||
region: '{{ scaleway_region }}'
|
||||
name: security_group
|
||||
description: 'my security group description'
|
||||
organization: '{{ scaleway_organization }}'
|
||||
stateful: false
|
||||
inbound_default_policy: accept
|
||||
outbound_default_policy: accept
|
||||
organization_default: false
|
||||
register: security_group_deletion
|
||||
|
||||
- debug: var=security_group_deletion
|
||||
|
||||
- name: Ensure security groups delete duplicate facts is success
|
||||
assert:
|
||||
that:
|
||||
- security_group_deletion is success
|
||||
- security_group_deletion is not changed
|
||||
@@ -0,0 +1,2 @@
|
||||
cloud/scaleway
|
||||
unsupported
|
||||
@@ -0,0 +1,29 @@
|
||||
# SCW_API_KEY='XXX' ansible-playbook ./test/legacy/scaleway.yml --tags test_scaleway_security_group_facts
|
||||
|
||||
- name: Get security group informations and register it in a variable
|
||||
scaleway_security_group_facts:
|
||||
region: par1
|
||||
register: security_groups
|
||||
|
||||
- name: Display security_groups variable
|
||||
debug:
|
||||
var: security_groups
|
||||
|
||||
- name: Ensure retrieval of security groups facts is success
|
||||
assert:
|
||||
that:
|
||||
- security_groups is success
|
||||
|
||||
- name: Get security group informations and register it in a variable (AMS1)
|
||||
scaleway_security_group_facts:
|
||||
region: ams1
|
||||
register: ams1_security_groups
|
||||
|
||||
- name: Display security_groups variable (AMS1)
|
||||
debug:
|
||||
var: ams1_security_groups
|
||||
|
||||
- name: Ensure retrieval of security groups facts is success (AMS1)
|
||||
assert:
|
||||
that:
|
||||
- ams1_security_groups is success
|
||||
@@ -0,0 +1,2 @@
|
||||
cloud/scaleway
|
||||
unsupported
|
||||
@@ -0,0 +1,8 @@
|
||||
---
|
||||
scaleway_organization: '{{ scw_org }}'
|
||||
scaleway_region: par1
|
||||
protocol: "TCP"
|
||||
port: 80
|
||||
ip_range: "0.0.0.0/0"
|
||||
direction: "inbound"
|
||||
action: "accept"
|
||||
@@ -0,0 +1,245 @@
|
||||
# SCW_API_KEY='XXX' ansible-playbook ./test/legacy/scaleway.yml --tags test_scaleway_security_group_rule
|
||||
|
||||
|
||||
- name: Create a scaleway security_group
|
||||
scaleway_security_group:
|
||||
state: present
|
||||
region: '{{ scaleway_region }}'
|
||||
name: test_compute
|
||||
description: test_compute
|
||||
organization: '{{ scaleway_organization }}'
|
||||
stateful: true
|
||||
inbound_default_policy: accept
|
||||
outbound_default_policy: accept
|
||||
organization_default: false
|
||||
register: security_group
|
||||
|
||||
- debug: var=security_group
|
||||
|
||||
- name: Create security_group_rule check
|
||||
check_mode: true
|
||||
scaleway_security_group_rule:
|
||||
state: present
|
||||
region: '{{ scaleway_region }}'
|
||||
protocol: '{{ protocol }}'
|
||||
port: '{{ port }}'
|
||||
ip_range: '{{ ip_range }}'
|
||||
direction: '{{ direction }}'
|
||||
action: '{{ action }}'
|
||||
security_group: '{{ security_group.scaleway_security_group.id }}'
|
||||
register: security_group_rule_creation_task
|
||||
|
||||
- debug: var=security_group_rule_creation_task
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- security_group_rule_creation_task is success
|
||||
- security_group_rule_creation_task is changed
|
||||
|
||||
- block:
|
||||
- name: Create security_group_rule check
|
||||
scaleway_security_group_rule:
|
||||
state: present
|
||||
region: '{{ scaleway_region }}'
|
||||
protocol: '{{ protocol }}'
|
||||
port: '{{ port }}'
|
||||
ip_range: '{{ ip_range }}'
|
||||
direction: '{{ direction }}'
|
||||
action: '{{ action }}'
|
||||
security_group: '{{ security_group.scaleway_security_group.id }}'
|
||||
register: security_group_rule_creation_task
|
||||
|
||||
- debug: var=security_group_rule_creation_task
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- security_group_rule_creation_task is success
|
||||
- security_group_rule_creation_task is changed
|
||||
|
||||
- name: Create security_group_rule duplicate
|
||||
scaleway_security_group_rule:
|
||||
state: present
|
||||
region: '{{ scaleway_region }}'
|
||||
protocol: '{{ protocol }}'
|
||||
port: '{{ port }}'
|
||||
ip_range: '{{ ip_range }}'
|
||||
direction: '{{ direction }}'
|
||||
action: '{{ action }}'
|
||||
security_group: '{{ security_group.scaleway_security_group.id }}'
|
||||
register: security_group_rule_creation_task
|
||||
|
||||
- debug: var=security_group_rule_creation_task
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- security_group_rule_creation_task is success
|
||||
- security_group_rule_creation_task is not changed
|
||||
|
||||
- name: Delete security_group_rule check
|
||||
check_mode: true
|
||||
scaleway_security_group_rule:
|
||||
state: absent
|
||||
region: '{{ scaleway_region }}'
|
||||
protocol: '{{ protocol }}'
|
||||
port: '{{ port }}'
|
||||
ip_range: '{{ ip_range }}'
|
||||
direction: '{{ direction }}'
|
||||
action: '{{ action }}'
|
||||
security_group: '{{ security_group.scaleway_security_group.id }}'
|
||||
register: security_group_rule_deletion_task
|
||||
|
||||
- debug: var=security_group_rule_deletion_task
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- security_group_rule_deletion_task is success
|
||||
- security_group_rule_deletion_task is changed
|
||||
|
||||
always:
|
||||
- name: Delete security_group_rule check
|
||||
scaleway_security_group_rule:
|
||||
state: absent
|
||||
region: '{{ scaleway_region }}'
|
||||
protocol: '{{ protocol }}'
|
||||
port: '{{ port }}'
|
||||
ip_range: '{{ ip_range }}'
|
||||
direction: '{{ direction }}'
|
||||
action: '{{ action }}'
|
||||
security_group: '{{ security_group.scaleway_security_group.id }}'
|
||||
register: security_group_rule_deletion_task
|
||||
|
||||
- debug: var=security_group_rule_deletion_task
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- security_group_rule_deletion_task is success
|
||||
- security_group_rule_deletion_task is changed
|
||||
|
||||
- name: Delete security_group_rule check
|
||||
scaleway_security_group_rule:
|
||||
state: absent
|
||||
region: '{{ scaleway_region }}'
|
||||
protocol: '{{ protocol }}'
|
||||
port: '{{ port }}'
|
||||
ip_range: '{{ ip_range }}'
|
||||
direction: '{{ direction }}'
|
||||
action: '{{ action }}'
|
||||
security_group: '{{ security_group.scaleway_security_group.id }}'
|
||||
register: security_group_rule_deletion_task
|
||||
|
||||
- debug: var=security_group_rule_deletion_task
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- security_group_rule_deletion_task is success
|
||||
- security_group_rule_deletion_task is not changed
|
||||
|
||||
- block:
|
||||
- name: Create security_group_rule with null check
|
||||
scaleway_security_group_rule:
|
||||
state: present
|
||||
region: '{{ scaleway_region }}'
|
||||
protocol: '{{ protocol }}'
|
||||
port: null
|
||||
ip_range: '{{ ip_range }}'
|
||||
direction: '{{ direction }}'
|
||||
action: '{{ action }}'
|
||||
security_group: '{{ security_group.scaleway_security_group.id }}'
|
||||
register: security_group_rule_creation_task
|
||||
|
||||
- debug: var=security_group_rule_creation_task
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- security_group_rule_creation_task is success
|
||||
- security_group_rule_creation_task is changed
|
||||
|
||||
- name: Create security_group_rule with null duplicate
|
||||
scaleway_security_group_rule:
|
||||
state: present
|
||||
region: '{{ scaleway_region }}'
|
||||
protocol: '{{ protocol }}'
|
||||
port: null
|
||||
ip_range: '{{ ip_range }}'
|
||||
direction: '{{ direction }}'
|
||||
action: '{{ action }}'
|
||||
security_group: '{{ security_group.scaleway_security_group.id }}'
|
||||
register: security_group_rule_creation_task
|
||||
|
||||
- debug: var=security_group_rule_creation_task
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- security_group_rule_creation_task is success
|
||||
- security_group_rule_creation_task is not changed
|
||||
|
||||
- name: Delete security_group_rule with null check
|
||||
check_mode: true
|
||||
scaleway_security_group_rule:
|
||||
state: absent
|
||||
region: '{{ scaleway_region }}'
|
||||
protocol: '{{ protocol }}'
|
||||
port: null
|
||||
ip_range: '{{ ip_range }}'
|
||||
direction: '{{ direction }}'
|
||||
action: '{{ action }}'
|
||||
security_group: '{{ security_group.scaleway_security_group.id }}'
|
||||
register: security_group_rule_deletion_task
|
||||
|
||||
- debug: var=security_group_rule_deletion_task
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- security_group_rule_deletion_task is success
|
||||
- security_group_rule_deletion_task is changed
|
||||
|
||||
always:
|
||||
- name: Delete security_group_rule with null check
|
||||
scaleway_security_group_rule:
|
||||
state: absent
|
||||
region: '{{ scaleway_region }}'
|
||||
protocol: '{{ protocol }}'
|
||||
port: null
|
||||
ip_range: '{{ ip_range }}'
|
||||
direction: '{{ direction }}'
|
||||
action: '{{ action }}'
|
||||
security_group: '{{ security_group.scaleway_security_group.id }}'
|
||||
register: security_group_rule_deletion_task
|
||||
|
||||
- debug: var=security_group_rule_deletion_task
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- security_group_rule_deletion_task is success
|
||||
- security_group_rule_deletion_task is changed
|
||||
|
||||
- name: Delete security_group_rule with null check
|
||||
scaleway_security_group_rule:
|
||||
state: absent
|
||||
region: '{{ scaleway_region }}'
|
||||
protocol: '{{ protocol }}'
|
||||
port: null
|
||||
ip_range: '{{ ip_range }}'
|
||||
direction: '{{ direction }}'
|
||||
action: '{{ action }}'
|
||||
security_group: '{{ security_group.scaleway_security_group.id }}'
|
||||
register: security_group_rule_deletion_task
|
||||
|
||||
- debug: var=security_group_rule_deletion_task
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- security_group_rule_deletion_task is success
|
||||
- security_group_rule_deletion_task is not changed
|
||||
|
||||
- name: Delete scaleway security_group
|
||||
scaleway_security_group:
|
||||
state: absent
|
||||
region: '{{ scaleway_region }}'
|
||||
name: test_compute
|
||||
description: test_compute
|
||||
organization: '{{ scaleway_organization }}'
|
||||
stateful: true
|
||||
inbound_default_policy: accept
|
||||
outbound_default_policy: accept
|
||||
organization_default: false
|
||||
2
test/integration/targets/scaleway_server_facts/aliases
Normal file
2
test/integration/targets/scaleway_server_facts/aliases
Normal file
@@ -0,0 +1,2 @@
|
||||
cloud/scaleway
|
||||
unsupported
|
||||
@@ -0,0 +1,29 @@
|
||||
# SCW_API_KEY='XXX' ansible-playbook ./test/legacy/scaleway.yml --tags test_scaleway_server_facts
|
||||
|
||||
- name: Get server informations and register it in a variable
|
||||
scaleway_server_facts:
|
||||
region: par1
|
||||
register: servers
|
||||
|
||||
- name: Display servers variable
|
||||
debug:
|
||||
var: servers
|
||||
|
||||
- name: Ensure retrieval of servers facts is success
|
||||
assert:
|
||||
that:
|
||||
- servers is success
|
||||
|
||||
- name: Get server informations and register it in a variable
|
||||
scaleway_server_facts:
|
||||
region: ams1
|
||||
register: ams1_servers
|
||||
|
||||
- name: Display servers variable
|
||||
debug:
|
||||
var: ams1_servers
|
||||
|
||||
- name: Ensure retrieval of servers facts is success
|
||||
assert:
|
||||
that:
|
||||
- ams1_servers is success
|
||||
2
test/integration/targets/scaleway_snapshot_facts/aliases
Normal file
2
test/integration/targets/scaleway_snapshot_facts/aliases
Normal file
@@ -0,0 +1,2 @@
|
||||
cloud/scaleway
|
||||
unsupported
|
||||
@@ -0,0 +1,29 @@
|
||||
# SCW_API_KEY='XXX' ansible-playbook ./test/legacy/scaleway.yml --tags test_scaleway_snapshot_facts
|
||||
|
||||
- name: Get snapshot informations and register it in a variable
|
||||
scaleway_snapshot_facts:
|
||||
region: par1
|
||||
register: snapshots
|
||||
|
||||
- name: Display snapshots variable
|
||||
debug:
|
||||
var: snapshots
|
||||
|
||||
- name: Ensure retrieval of snapshots facts is success
|
||||
assert:
|
||||
that:
|
||||
- snapshots is success
|
||||
|
||||
- name: Get snapshot informations and register it in a variable (AMS1)
|
||||
scaleway_snapshot_facts:
|
||||
region: ams1
|
||||
register: ams1_snapshots
|
||||
|
||||
- name: Display snapshots variable (AMS1)
|
||||
debug:
|
||||
var: ams1_snapshots
|
||||
|
||||
- name: Ensure retrieval of snapshots facts is success (AMS1)
|
||||
assert:
|
||||
that:
|
||||
- ams1_snapshots is success
|
||||
2
test/integration/targets/scaleway_ssh/aliases
Normal file
2
test/integration/targets/scaleway_ssh/aliases
Normal file
@@ -0,0 +1,2 @@
|
||||
cloud/scaleway
|
||||
unsupported
|
||||
41
test/integration/targets/scaleway_ssh/tasks/main.yml
Normal file
41
test/integration/targets/scaleway_ssh/tasks/main.yml
Normal file
@@ -0,0 +1,41 @@
|
||||
# SCW_API_KEY='XXX' ansible-playbook ./test/legacy/scaleway.yml --tags test_scaleway_ssh
|
||||
|
||||
- scaleway_sshkey:
|
||||
ssh_pub_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDf29yyommeGyKSIgSmX0ISVXP+3x6RUY4JDGLoAMFh2efkfDaRVdsvkvnFuUywgP2RewrjTyLE8w0NpCBHVS5Fm1BAn3yvxOUtTMxTbsQcw6HQ8swJ02+1tewJYjHPwc4GrBqiDo3Nmlq354Us0zBOJg/bBzuEnVD5eJ3GO3gKaCSUYTVrYwO0U4eJE0D9OJeUP9J48kl4ULbCub976+mTHdBvlzRw0Tzfl2kxgdDwlks0l2NefY/uiTdz2oMt092bAY3wZHxjto/DXoChxvaf5s2k8Zb+J7CjimUYnzPlH+zA9F6ROjP5AUu6ZWPd0jOIBl1nDWWb2j/qfNLYM43l sieben@sieben-macbook.local"
|
||||
state: present
|
||||
check_mode: yes
|
||||
|
||||
- scaleway_sshkey:
|
||||
ssh_pub_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDf29yyommeGyKSIgSmX0ISVXP+3x6RUY4JDGLoAMFh2efkfDaRVdsvkvnFuUywgP2RewrjTyLE8w0NpCBHVS5Fm1BAn3yvxOUtTMxTbsQcw6HQ8swJ02+1tewJYjHPwc4GrBqiDo3Nmlq354Us0zBOJg/bBzuEnVD5eJ3GO3gKaCSUYTVrYwO0U4eJE0D9OJeUP9J48kl4ULbCub976+mTHdBvlzRw0Tzfl2kxgdDwlks0l2NefY/uiTdz2oMt092bAY3wZHxjto/DXoChxvaf5s2k8Zb+J7CjimUYnzPlH+zA9F6ROjP5AUu6ZWPd0jOIBl1nDWWb2j/qfNLYM43l sieben@sieben-macbook.local"
|
||||
state: present
|
||||
register: result1
|
||||
|
||||
- scaleway_sshkey:
|
||||
ssh_pub_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDf29yyommeGyKSIgSmX0ISVXP+3x6RUY4JDGLoAMFh2efkfDaRVdsvkvnFuUywgP2RewrjTyLE8w0NpCBHVS5Fm1BAn3yvxOUtTMxTbsQcw6HQ8swJ02+1tewJYjHPwc4GrBqiDo3Nmlq354Us0zBOJg/bBzuEnVD5eJ3GO3gKaCSUYTVrYwO0U4eJE0D9OJeUP9J48kl4ULbCub976+mTHdBvlzRw0Tzfl2kxgdDwlks0l2NefY/uiTdz2oMt092bAY3wZHxjto/DXoChxvaf5s2k8Zb+J7CjimUYnzPlH+zA9F6ROjP5AUu6ZWPd0jOIBl1nDWWb2j/qfNLYM43l sieben@sieben-macbook.local"
|
||||
state: present
|
||||
register: result2
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result1 is success and result1 is changed
|
||||
- result2 is success and result2 is not changed
|
||||
|
||||
- scaleway_sshkey:
|
||||
ssh_pub_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDf29yyommeGyKSIgSmX0ISVXP+3x6RUY4JDGLoAMFh2efkfDaRVdsvkvnFuUywgP2RewrjTyLE8w0NpCBHVS5Fm1BAn3yvxOUtTMxTbsQcw6HQ8swJ02+1tewJYjHPwc4GrBqiDo3Nmlq354Us0zBOJg/bBzuEnVD5eJ3GO3gKaCSUYTVrYwO0U4eJE0D9OJeUP9J48kl4ULbCub976+mTHdBvlzRw0Tzfl2kxgdDwlks0l2NefY/uiTdz2oMt092bAY3wZHxjto/DXoChxvaf5s2k8Zb+J7CjimUYnzPlH+zA9F6ROjP5AUu6ZWPd0jOIBl1nDWWb2j/qfNLYM43l sieben@sieben-macbook.local"
|
||||
state: absent
|
||||
check_mode: yes
|
||||
|
||||
- scaleway_sshkey:
|
||||
ssh_pub_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDf29yyommeGyKSIgSmX0ISVXP+3x6RUY4JDGLoAMFh2efkfDaRVdsvkvnFuUywgP2RewrjTyLE8w0NpCBHVS5Fm1BAn3yvxOUtTMxTbsQcw6HQ8swJ02+1tewJYjHPwc4GrBqiDo3Nmlq354Us0zBOJg/bBzuEnVD5eJ3GO3gKaCSUYTVrYwO0U4eJE0D9OJeUP9J48kl4ULbCub976+mTHdBvlzRw0Tzfl2kxgdDwlks0l2NefY/uiTdz2oMt092bAY3wZHxjto/DXoChxvaf5s2k8Zb+J7CjimUYnzPlH+zA9F6ROjP5AUu6ZWPd0jOIBl1nDWWb2j/qfNLYM43l sieben@sieben-macbook.local"
|
||||
state: absent
|
||||
register: result1
|
||||
|
||||
- scaleway_sshkey:
|
||||
ssh_pub_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDf29yyommeGyKSIgSmX0ISVXP+3x6RUY4JDGLoAMFh2efkfDaRVdsvkvnFuUywgP2RewrjTyLE8w0NpCBHVS5Fm1BAn3yvxOUtTMxTbsQcw6HQ8swJ02+1tewJYjHPwc4GrBqiDo3Nmlq354Us0zBOJg/bBzuEnVD5eJ3GO3gKaCSUYTVrYwO0U4eJE0D9OJeUP9J48kl4ULbCub976+mTHdBvlzRw0Tzfl2kxgdDwlks0l2NefY/uiTdz2oMt092bAY3wZHxjto/DXoChxvaf5s2k8Zb+J7CjimUYnzPlH+zA9F6ROjP5AUu6ZWPd0jOIBl1nDWWb2j/qfNLYM43l sieben@sieben-macbook.local"
|
||||
state: absent
|
||||
register: result2
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result1 is success and result1 is changed
|
||||
- result2 is success and result2 is not changed
|
||||
2
test/integration/targets/scaleway_user_data/aliases
Normal file
2
test/integration/targets/scaleway_user_data/aliases
Normal file
@@ -0,0 +1,2 @@
|
||||
cloud/scaleway
|
||||
unsupported
|
||||
@@ -0,0 +1,15 @@
|
||||
---
|
||||
|
||||
cloud_init_script: '''
|
||||
#cloud-config
|
||||
|
||||
# final_message
|
||||
# default: cloud-init boot finished at $TIMESTAMP. Up $UPTIME seconds
|
||||
# this message is written by cloud-final when the system is finished
|
||||
# its first boot
|
||||
final_message: "The system is finally up, after $UPTIME seconds"
|
||||
'''
|
||||
scaleway_image_id: 89ee4018-f8c3-4dc4-a6b5-bca14f985ebe
|
||||
scaleway_organization: '{{ scw_org }}'
|
||||
scaleway_region: ams1
|
||||
scaleway_commerial_type: START1-S
|
||||
79
test/integration/targets/scaleway_user_data/tasks/main.yml
Normal file
79
test/integration/targets/scaleway_user_data/tasks/main.yml
Normal file
@@ -0,0 +1,79 @@
|
||||
# SCW_API_KEY='XXX' ansible-playbook ./test/legacy/scaleway.yml --tags test_scaleway_user_data
|
||||
|
||||
- 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
|
||||
|
||||
- set_fact:
|
||||
server_id: "{{ server_creation_task.msg.id }}"
|
||||
|
||||
- debug: var=server_id
|
||||
|
||||
- name: Patch user_data cloud-init configuration (Check)
|
||||
check_mode: yes
|
||||
scaleway_user_data:
|
||||
region: '{{ scaleway_region }}'
|
||||
server_id: "{{ server_id }}"
|
||||
user_data:
|
||||
cloud-init: "{{ cloud_init_script }}"
|
||||
register: user_data_check_task
|
||||
|
||||
- debug: var=user_data_check_task
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- user_data_check_task is success
|
||||
- user_data_check_task is changed
|
||||
|
||||
- name: Patch user_data cloud-init configuration
|
||||
scaleway_user_data:
|
||||
region: '{{ scaleway_region }}'
|
||||
server_id: "{{ server_id }}"
|
||||
user_data:
|
||||
cloud-init: "{{ cloud_init_script }}"
|
||||
register: user_data_task
|
||||
|
||||
- debug: var=user_data_task
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- user_data_task is success
|
||||
- user_data_task is changed
|
||||
|
||||
- name: Patch user_data cloud-init configuration (Confirmation)
|
||||
scaleway_user_data:
|
||||
region: '{{ scaleway_region }}'
|
||||
server_id: "{{ server_id }}"
|
||||
user_data:
|
||||
cloud-init: "{{ cloud_init_script }}"
|
||||
register: user_data_confirmation_task
|
||||
|
||||
- debug: var=user_data_confirmation_task
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- user_data_confirmation_task is success
|
||||
- user_data_confirmation_task is not changed
|
||||
|
||||
- name: Destroy it
|
||||
scaleway_compute:
|
||||
name: foobar
|
||||
state: absent
|
||||
region: '{{ scaleway_region }}'
|
||||
image: '{{ scaleway_image_id }}'
|
||||
organization: '{{ scaleway_organization }}'
|
||||
commercial_type: '{{ scaleway_commerial_type }}'
|
||||
wait: true
|
||||
register: server_destroy_task
|
||||
|
||||
- debug: var=server_destroy_task
|
||||
2
test/integration/targets/scaleway_volume/aliases
Normal file
2
test/integration/targets/scaleway_volume/aliases
Normal file
@@ -0,0 +1,2 @@
|
||||
cloud/scaleway
|
||||
unsupported
|
||||
@@ -0,0 +1,3 @@
|
||||
---
|
||||
scaleway_organization: '{{ scw_org }}'
|
||||
scaleway_region: ams1
|
||||
43
test/integration/targets/scaleway_volume/tasks/main.yml
Normal file
43
test/integration/targets/scaleway_volume/tasks/main.yml
Normal file
@@ -0,0 +1,43 @@
|
||||
# SCW_API_KEY='XXX' SCW_ORG='YYY' ansible-playbook ./test/legacy/scaleway.yml --tags test_scaleway_volume
|
||||
|
||||
- name: Make sure volume is not there before tests
|
||||
scaleway_volume:
|
||||
name: ansible-test-volume
|
||||
state: absent
|
||||
region: '{{ scaleway_region }}'
|
||||
organization: '{{ scaleway_organization }}'
|
||||
register: server_creation_check_task
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- server_creation_check_task is success
|
||||
|
||||
- name: Create volume
|
||||
scaleway_volume:
|
||||
name: ansible-test-volume
|
||||
state: present
|
||||
region: '{{ scaleway_region }}'
|
||||
organization: '{{ scaleway_organization }}'
|
||||
"size": 10000000000
|
||||
volume_type: l_ssd
|
||||
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: Make sure volume is deleted
|
||||
scaleway_volume:
|
||||
name: ansible-test-volume
|
||||
state: absent
|
||||
region: '{{ scaleway_region }}'
|
||||
organization: '{{ scaleway_organization }}'
|
||||
register: server_creation_check_task
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- server_creation_check_task is success
|
||||
- server_creation_check_task is changed
|
||||
2
test/integration/targets/scaleway_volume_facts/aliases
Normal file
2
test/integration/targets/scaleway_volume_facts/aliases
Normal file
@@ -0,0 +1,2 @@
|
||||
cloud/scaleway
|
||||
unsupported
|
||||
@@ -0,0 +1,29 @@
|
||||
# SCW_API_KEY='XXX' ansible-playbook ./test/legacy/scaleway.yml --tags test_scaleway_volume_facts
|
||||
|
||||
- name: Get volume informations and register it in a variable
|
||||
scaleway_volume_facts:
|
||||
region: par1
|
||||
register: volumes
|
||||
|
||||
- name: Display volumes variable
|
||||
debug:
|
||||
var: volumes
|
||||
|
||||
- name: Ensure retrieval of volumes facts is success
|
||||
assert:
|
||||
that:
|
||||
- volumes is success
|
||||
|
||||
- name: Get volume informations and register it in a variable (AMS1)
|
||||
scaleway_volume_facts:
|
||||
region: ams1
|
||||
register: ams1_volumes
|
||||
|
||||
- name: Display volumes variable
|
||||
debug:
|
||||
var: ams1_volumes
|
||||
|
||||
- name: Ensure retrieval of volumes facts is success
|
||||
assert:
|
||||
that:
|
||||
- ams1_volumes is success
|
||||
Reference in New Issue
Block a user