mirror of https://github.com/ansible/ansible.git
scaleway: Refactor modules
parent
29cfebe332
commit
8f9d55529d
@ -0,0 +1,6 @@
|
|||||||
|
# Below information has been taken from https://developer.scaleway.com/#servers
|
||||||
|
---
|
||||||
|
scaleway_image_id: 89ee4018-f8c3-4dc4-a6b5-bca14f985ebe
|
||||||
|
scaleway_organization: '{{ scw_org }}'
|
||||||
|
scaleway_region: ams1
|
||||||
|
scaleway_commerial_type: START1-S
|
||||||
@ -0,0 +1,388 @@
|
|||||||
|
# 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
|
||||||
@ -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
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
scaleway_organization: '{{ scw_org }}'
|
||||||
|
scaleway_region: ams1
|
||||||
@ -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
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
gather_facts: no
|
||||||
|
connection: local
|
||||||
|
environment:
|
||||||
|
SCW_API_KEY: "{{ lookup('env', 'SCW_API_KEY') }}"
|
||||||
|
vars:
|
||||||
|
scw_org: "{{ lookup('env', 'SCW_ORG') }}"
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- { role: scaleway_ssh, tags: test_scaleway_ssh }
|
||||||
|
- { role: scaleway_volume, tags: test_scaleway_volume }
|
||||||
|
- { role: scaleway_compute, tags: test_scaleway_compute }
|
||||||
@ -1,396 +0,0 @@
|
|||||||
# SCW_API_KEY='XXX' ansible-playbook ./test/legacy/scaleway_compute.yml
|
|
||||||
|
|
||||||
- name: Test compute instance lifecyle on a Scaleway account
|
|
||||||
hosts: localhost
|
|
||||||
gather_facts: no
|
|
||||||
environment:
|
|
||||||
SCW_API_KEY: "{{ lookup('env', 'SCW_API_KEY') }}"
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
|
|
||||||
- name: Create a server (Check)
|
|
||||||
check_mode: yes
|
|
||||||
scaleway_compute:
|
|
||||||
name: foobar
|
|
||||||
state: present
|
|
||||||
image: 89ee4018-f8c3-4dc4-a6b5-bca14f985ebe
|
|
||||||
organization: 951df375-e094-4d26-97c1-ba548eeb9c42
|
|
||||||
region: ams1
|
|
||||||
commercial_type: START1-S
|
|
||||||
|
|
||||||
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: 89ee4018-f8c3-4dc4-a6b5-bca14f985ebe
|
|
||||||
organization: 951df375-e094-4d26-97c1-ba548eeb9c42
|
|
||||||
region: ams1
|
|
||||||
commercial_type: START1-S
|
|
||||||
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: 89ee4018-f8c3-4dc4-a6b5-bca14f985ebe
|
|
||||||
organization: 951df375-e094-4d26-97c1-ba548eeb9c42
|
|
||||||
region: ams1
|
|
||||||
commercial_type: START1-S
|
|
||||||
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: 89ee4018-f8c3-4dc4-a6b5-bca14f985ebe
|
|
||||||
organization: 951df375-e094-4d26-97c1-ba548eeb9c42
|
|
||||||
region: ams1
|
|
||||||
commercial_type: START1-S
|
|
||||||
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: 89ee4018-f8c3-4dc4-a6b5-bca14f985ebe
|
|
||||||
organization: 951df375-e094-4d26-97c1-ba548eeb9c42
|
|
||||||
region: ams1
|
|
||||||
commercial_type: START1-S
|
|
||||||
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: 89ee4018-f8c3-4dc4-a6b5-bca14f985ebe
|
|
||||||
organization: 951df375-e094-4d26-97c1-ba548eeb9c42
|
|
||||||
region: ams1
|
|
||||||
commercial_type: START1-S
|
|
||||||
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: 89ee4018-f8c3-4dc4-a6b5-bca14f985ebe
|
|
||||||
organization: 951df375-e094-4d26-97c1-ba548eeb9c42
|
|
||||||
region: ams1
|
|
||||||
commercial_type: START1-S
|
|
||||||
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: 89ee4018-f8c3-4dc4-a6b5-bca14f985ebe
|
|
||||||
organization: 951df375-e094-4d26-97c1-ba548eeb9c42
|
|
||||||
region: ams1
|
|
||||||
commercial_type: START1-S
|
|
||||||
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: 89ee4018-f8c3-4dc4-a6b5-bca14f985ebe
|
|
||||||
organization: 951df375-e094-4d26-97c1-ba548eeb9c42
|
|
||||||
region: ams1
|
|
||||||
commercial_type: START1-S
|
|
||||||
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: 89ee4018-f8c3-4dc4-a6b5-bca14f985ebe
|
|
||||||
organization: 951df375-e094-4d26-97c1-ba548eeb9c42
|
|
||||||
region: ams1
|
|
||||||
commercial_type: START1-S
|
|
||||||
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: 89ee4018-f8c3-4dc4-a6b5-bca14f985ebe
|
|
||||||
organization: 951df375-e094-4d26-97c1-ba548eeb9c42
|
|
||||||
region: ams1
|
|
||||||
commercial_type: START1-S
|
|
||||||
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: 89ee4018-f8c3-4dc4-a6b5-bca14f985ebe
|
|
||||||
organization: 951df375-e094-4d26-97c1-ba548eeb9c42
|
|
||||||
region: ams1
|
|
||||||
commercial_type: START1-S
|
|
||||||
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: 89ee4018-f8c3-4dc4-a6b5-bca14f985ebe
|
|
||||||
organization: 951df375-e094-4d26-97c1-ba548eeb9c42
|
|
||||||
region: ams1
|
|
||||||
commercial_type: START1-S
|
|
||||||
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: 89ee4018-f8c3-4dc4-a6b5-bca14f985ebe
|
|
||||||
organization: 951df375-e094-4d26-97c1-ba548eeb9c42
|
|
||||||
region: ams1
|
|
||||||
commercial_type: START1-S
|
|
||||||
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: 89ee4018-f8c3-4dc4-a6b5-bca14f985ebe
|
|
||||||
organization: 951df375-e094-4d26-97c1-ba548eeb9c42
|
|
||||||
region: ams1
|
|
||||||
commercial_type: START1-S
|
|
||||||
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: 89ee4018-f8c3-4dc4-a6b5-bca14f985ebe
|
|
||||||
organization: 951df375-e094-4d26-97c1-ba548eeb9c42
|
|
||||||
region: ams1
|
|
||||||
commercial_type: START1-S
|
|
||||||
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: 89ee4018-f8c3-4dc4-a6b5-bca14f985ebe
|
|
||||||
organization: 951df375-e094-4d26-97c1-ba548eeb9c42
|
|
||||||
region: ams1
|
|
||||||
commercial_type: START1-S
|
|
||||||
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: 89ee4018-f8c3-4dc4-a6b5-bca14f985ebe
|
|
||||||
organization: this-organization-does-not-exists
|
|
||||||
region: ams1
|
|
||||||
commercial_type: START1-S
|
|
||||||
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: 951df375-e094-4d26-97c1-ba548eeb9c42
|
|
||||||
region: ams1
|
|
||||||
commercial_type: START1-S
|
|
||||||
register: unexisting_image_check
|
|
||||||
|
|
||||||
- debug: var=unexisting_image_check
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- unexisting_image_check is not success
|
|
||||||
- unexisting_image_check is not changed
|
|
||||||
@ -1,49 +0,0 @@
|
|||||||
# SCW_API_KEY='XXX' ansible-playbook ./test/legacy/scaleway_ssh_playbook.yml
|
|
||||||
|
|
||||||
- name: Test SSH key lifecyle on a Scaleway account
|
|
||||||
hosts: localhost
|
|
||||||
gather_facts: no
|
|
||||||
environment:
|
|
||||||
SCW_API_KEY: "{{ lookup('env', 'SCW_API_KEY') }}"
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
|
|
||||||
- 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
|
|
||||||
@ -1,53 +0,0 @@
|
|||||||
# SCW_API_KEY='XXX' SCW_ORG='YYY' ansible-playbook ./test/legacy/scaleway_volume.yml
|
|
||||||
|
|
||||||
- name: Test compute instance lifecyle on a Scaleway account
|
|
||||||
hosts: localhost
|
|
||||||
gather_facts: no
|
|
||||||
environment:
|
|
||||||
SCW_API_KEY: "{{ lookup('env', 'SCW_API_KEY') }}"
|
|
||||||
vars:
|
|
||||||
scw_org: "{{ lookup('env', 'SCW_ORG') }}"
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
|
|
||||||
- name: Make sure volume is not there before tests
|
|
||||||
scaleway_volume:
|
|
||||||
name: ansible-test-volume
|
|
||||||
state: absent
|
|
||||||
region: par1
|
|
||||||
organization: "{{ scw_org }}"
|
|
||||||
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: par1
|
|
||||||
organization: "{{ scw_org }}"
|
|
||||||
"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: par1
|
|
||||||
organization: "{{ scw_org }}"
|
|
||||||
register: server_creation_check_task
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- server_creation_check_task is success
|
|
||||||
- server_creation_check_task is changed
|
|
||||||
Loading…
Reference in New Issue