diff options
author | Rémy Léone <rleone@online.net> | 2018-08-20 10:50:28 +0200 |
---|---|---|
committer | Michael Scherer <mscherer@users.noreply.github.com> | 2018-08-24 18:15:45 +0200 |
commit | 8f9d55529d5a91273e3d634b4b3c22948af1fb13 (patch) | |
tree | 39d2af33fb5e43f4ca3b91a3803bba208ed48170 /test/legacy | |
parent | 29cfebe3320ec8f3392e00c4dba38cfe391f637a (diff) | |
download | ansible-8f9d55529d5a91273e3d634b4b3c22948af1fb13.tar.gz |
scaleway: Refactor modules
Diffstat (limited to 'test/legacy')
-rw-r--r-- | test/legacy/roles/scaleway_compute/defaults/main.yml | 6 | ||||
-rw-r--r-- | test/legacy/roles/scaleway_compute/tasks/main.yml | 388 | ||||
-rw-r--r-- | test/legacy/roles/scaleway_ssh/tasks/main.yml | 41 | ||||
-rw-r--r-- | test/legacy/roles/scaleway_volume/defaults/main.yml | 3 | ||||
-rw-r--r-- | test/legacy/roles/scaleway_volume/tasks/main.yml | 43 | ||||
-rw-r--r-- | test/legacy/scaleway.yml | 13 | ||||
-rw-r--r-- | test/legacy/scaleway_compute.yml | 396 | ||||
-rw-r--r-- | test/legacy/scaleway_ssh_playbook.yml | 49 | ||||
-rw-r--r-- | test/legacy/scaleway_volume.yml | 53 |
9 files changed, 494 insertions, 498 deletions
diff --git a/test/legacy/roles/scaleway_compute/defaults/main.yml b/test/legacy/roles/scaleway_compute/defaults/main.yml new file mode 100644 index 0000000000..1b31647861 --- /dev/null +++ b/test/legacy/roles/scaleway_compute/defaults/main.yml @@ -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 diff --git a/test/legacy/roles/scaleway_compute/tasks/main.yml b/test/legacy/roles/scaleway_compute/tasks/main.yml new file mode 100644 index 0000000000..80c8fc186d --- /dev/null +++ b/test/legacy/roles/scaleway_compute/tasks/main.yml @@ -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 diff --git a/test/legacy/roles/scaleway_ssh/tasks/main.yml b/test/legacy/roles/scaleway_ssh/tasks/main.yml new file mode 100644 index 0000000000..f6ae57890e --- /dev/null +++ b/test/legacy/roles/scaleway_ssh/tasks/main.yml @@ -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 diff --git a/test/legacy/roles/scaleway_volume/defaults/main.yml b/test/legacy/roles/scaleway_volume/defaults/main.yml new file mode 100644 index 0000000000..13bbef06af --- /dev/null +++ b/test/legacy/roles/scaleway_volume/defaults/main.yml @@ -0,0 +1,3 @@ +--- +scaleway_organization: '{{ scw_org }}' +scaleway_region: ams1 diff --git a/test/legacy/roles/scaleway_volume/tasks/main.yml b/test/legacy/roles/scaleway_volume/tasks/main.yml new file mode 100644 index 0000000000..0546dabe0f --- /dev/null +++ b/test/legacy/roles/scaleway_volume/tasks/main.yml @@ -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 diff --git a/test/legacy/scaleway.yml b/test/legacy/scaleway.yml new file mode 100644 index 0000000000..c88e546588 --- /dev/null +++ b/test/legacy/scaleway.yml @@ -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 } diff --git a/test/legacy/scaleway_compute.yml b/test/legacy/scaleway_compute.yml deleted file mode 100644 index 67984910b8..0000000000 --- a/test/legacy/scaleway_compute.yml +++ /dev/null @@ -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 diff --git a/test/legacy/scaleway_ssh_playbook.yml b/test/legacy/scaleway_ssh_playbook.yml deleted file mode 100644 index aabb9ced4a..0000000000 --- a/test/legacy/scaleway_ssh_playbook.yml +++ /dev/null @@ -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 diff --git a/test/legacy/scaleway_volume.yml b/test/legacy/scaleway_volume.yml deleted file mode 100644 index 5ef999027c..0000000000 --- a/test/legacy/scaleway_volume.yml +++ /dev/null @@ -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 |