diff options
author | Ansible Core Team <info@ansible.com> | 2020-03-09 09:40:36 +0000 |
---|---|---|
committer | Ansible Core Team <info@ansible.com> | 2020-03-09 09:40:36 +0000 |
commit | 774498628b2c2ce1fc1e02a94f141f1e17e94cd1 (patch) | |
tree | e3620cde1c5f6cc7a735b87f82c6977d5a7a7e6a /test/integration | |
parent | 6ea22818476eb22d761a958b27e01ee2dc1b9a55 (diff) | |
download | ansible-774498628b2c2ce1fc1e02a94f141f1e17e94cd1.tar.gz |
Migrated to hetzner.hcloud
Diffstat (limited to 'test/integration')
56 files changed, 0 insertions, 2817 deletions
diff --git a/test/integration/targets/hcloud_datacenter_info/aliases b/test/integration/targets/hcloud_datacenter_info/aliases deleted file mode 100644 index 55ec821a47..0000000000 --- a/test/integration/targets/hcloud_datacenter_info/aliases +++ /dev/null @@ -1,2 +0,0 @@ -cloud/hcloud -shippable/hcloud/group2 diff --git a/test/integration/targets/hcloud_datacenter_info/defaults/main.yml b/test/integration/targets/hcloud_datacenter_info/defaults/main.yml deleted file mode 100644 index b9e045f407..0000000000 --- a/test/integration/targets/hcloud_datacenter_info/defaults/main.yml +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -hcloud_datacenter_name: "fsn1-dc14" -hcloud_datacenter_id: 4 -hcloud_location_name: "fsn1" diff --git a/test/integration/targets/hcloud_datacenter_info/tasks/main.yml b/test/integration/targets/hcloud_datacenter_info/tasks/main.yml deleted file mode 100644 index 7f49b040c5..0000000000 --- a/test/integration/targets/hcloud_datacenter_info/tasks/main.yml +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -- name: test gather hcloud datacenter infos - hcloud_datacenter_info: - register: hcloud_datacenters - -- name: verify test gather hcloud datacenter infos - assert: - that: - - hcloud_datacenters.hcloud_datacenter_info| list | count == 3 - -- name: test gather hcloud datacenter infos in check mode - hcloud_datacenter_info: - register: hcloud_datacenters - check_mode: yes - -- name: verify test gather hcloud datacenter infos in check mode - assert: - that: - - hcloud_datacenters.hcloud_datacenter_info| list | count == 3 - - -- name: test gather hcloud datacenter infos with correct name - hcloud_datacenter_info: - name: "{{hcloud_datacenter_name}}" - register: hcloud_datacenter -- name: verify test gather hcloud datacenter with correct name - assert: - that: - - hcloud_datacenter.hcloud_datacenter_info|selectattr('name','equalto','{{ hcloud_datacenter_name }}') |selectattr('location','equalto','{{ hcloud_location_name }}') | list | count == 1 - -- name: test gather hcloud datacenter infos with correct id - hcloud_datacenter_info: - id: "{{hcloud_datacenter_id}}" - register: hcloud_datacenter -- name: verify test gather hcloud datacenter with correct id - assert: - that: - - hcloud_datacenter.hcloud_datacenter_info|selectattr('name','equalto','{{ hcloud_datacenter_name }}') | list | count == 1 diff --git a/test/integration/targets/hcloud_floating_ip/aliases b/test/integration/targets/hcloud_floating_ip/aliases deleted file mode 100644 index 55ec821a47..0000000000 --- a/test/integration/targets/hcloud_floating_ip/aliases +++ /dev/null @@ -1,2 +0,0 @@ -cloud/hcloud -shippable/hcloud/group2 diff --git a/test/integration/targets/hcloud_floating_ip/defaults/main.yml b/test/integration/targets/hcloud_floating_ip/defaults/main.yml deleted file mode 100644 index fc60d28184..0000000000 --- a/test/integration/targets/hcloud_floating_ip/defaults/main.yml +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -hcloud_prefix: "tests" -hcloud_floating_ip_name: "{{hcloud_prefix}}-integration" -hcloud_server_name: "{{hcloud_prefix}}-fip-tests"
\ No newline at end of file diff --git a/test/integration/targets/hcloud_floating_ip/tasks/main.yml b/test/integration/targets/hcloud_floating_ip/tasks/main.yml deleted file mode 100644 index 7b1590a2e0..0000000000 --- a/test/integration/targets/hcloud_floating_ip/tasks/main.yml +++ /dev/null @@ -1,384 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -- name: setup server - hcloud_server: - name: "{{ hcloud_server_name }}" - server_type: cx11 - image: ubuntu-18.04 - state: started - location: "fsn1" - register: main_server -- name: verify setup server - assert: - that: - - main_server is changed - -- name: setup another server - hcloud_server: - name: "{{ hcloud_server_name }}2" - server_type: cx11 - image: ubuntu-18.04 - state: started - register: main_server2 -- name: verify setup another server - assert: - that: - - main_server2 is changed - -- name: test missing type parameter on create Floating IP - hcloud_floating_ip: - name: "{{ hcloud_floating_ip_name }}" - register: result - ignore_errors: yes -- name: verify fail test missing type parameter on create Floating IP - assert: - that: - - result is failed - - 'result.msg == "missing required arguments: type"' - -- name: test missing required parameters on create Floating IP - hcloud_floating_ip: - name: "{{ hcloud_floating_ip_name }}" - type: ipv4 - register: result - ignore_errors: yes -- name: verify fail test missing required parameters on create Floating IP - assert: - that: - - result is failed - - 'result.msg == "one of the following is required: home_location, server"' - -- name: test missing type parameter on delete Floating IP - hcloud_floating_ip: - type: ipv4 - home_location: "fsn1" - state: "absent" - register: result - ignore_errors: yes -- name: verify fail test missing type parameter on delete Floating IP - assert: - that: - - result is failed - - 'result.msg == "one of the following is required: id, name"' - -- name: test create Floating IP with check mode - hcloud_floating_ip: - name: "{{ hcloud_floating_ip_name }}" - description: "Web Server" - type: ipv4 - home_location: "fsn1" - register: floatingIP - check_mode: yes -- name: verify test create Floating IP with check mode - assert: - that: - - floatingIP is changed - -- name: test create Floating IP - hcloud_floating_ip: - name: "{{ hcloud_floating_ip_name }}" - description: "Web Server" - type: ipv4 - home_location: "fsn1" - register: floatingIP -- name: verify test create Floating IP - assert: - that: - - floatingIP is changed - - floatingIP.hcloud_floating_ip.name ==hcloud_floating_ip_name - - floatingIP.hcloud_floating_ip.description == "Web Server" - - floatingIP.hcloud_floating_ip.home_location == "fsn1" - -- name: test create Floating IP idempotency - hcloud_floating_ip: - name: "{{ hcloud_floating_ip_name }}" - description: "Web Server" - type: ipv4 - home_location: "fsn1" - register: floatingIP -- name: verify test create Floating IP idempotency - assert: - that: - - floatingIP is not changed - -- name: test update Floating IP with check mode - hcloud_floating_ip: - name: "{{ hcloud_floating_ip_name }}" - description: "changed-description" - type: ipv4 - home_location: "fsn1" - check_mode: yes - register: floatingIP -- name: verify test create Floating IP with check mode - assert: - that: - - floatingIP is changed - - floatingIP.hcloud_floating_ip.description == "Web Server" - -- name: test update Floating IP - hcloud_floating_ip: - name: "{{ hcloud_floating_ip_name }}" - description: "changed-description" - type: ipv4 - home_location: "fsn1" - labels: - key: value - register: floatingIP -- name: verify test update Floating IP - assert: - that: - - floatingIP is changed - - floatingIP.hcloud_floating_ip.description == "changed-description" - -- name: test update Floating IP idempotency - hcloud_floating_ip: - name: "{{ hcloud_floating_ip_name }}" - description: "changed-description" - type: ipv4 - home_location: "fsn1" - labels: - key: value - register: floatingIP -- name: verify test update Floating IP idempotency - assert: - that: - - floatingIP is not changed - -- name: test update Floating IP with same labels - hcloud_floating_ip: - name: "{{ hcloud_floating_ip_name }}" - type: ipv4 - home_location: "fsn1" - labels: - key: value - register: floatingIP -- name: verify test update Floating IP with same labels - assert: - that: - - floatingIP is not changed - -- name: test update Floating IP with other labels - hcloud_floating_ip: - name: "{{ hcloud_floating_ip_name }}" - type: ipv4 - home_location: "fsn1" - labels: - key: value - other: label - register: floatingIP -- name: verify test update Floating IP with other labels - assert: - that: - - floatingIP is changed - -- name: test update Floating IP with other labels in different order - hcloud_floating_ip: - name: "{{ hcloud_floating_ip_name }}" - type: ipv4 - home_location: "fsn1" - labels: - other: label - key: value - register: floatingIP -- name: verify test update Floating IP with other labels in different order - assert: - that: - - floatingIP is not changed - -- name: test assign Floating IP with checkmode - hcloud_floating_ip: - name: "{{ hcloud_floating_ip_name }}" - description: "changed-description" - type: ipv4 - server: "{{ main_server.hcloud_server.name }}" - check_mode: yes - register: floatingIP -- name: verify test assign Floating IP with checkmode - assert: - that: - - floatingIP is changed - - floatingIP.hcloud_floating_ip.server != "{{ main_server.hcloud_server.name }}" - -- name: test assign Floating IP - hcloud_floating_ip: - name: "{{ hcloud_floating_ip_name }}" - description: "changed-description" - type: ipv4 - server: "{{ main_server.hcloud_server.name }}" - register: floatingIP -- name: verify test assign Floating IP - assert: - that: - - floatingIP is changed - - floatingIP.hcloud_floating_ip.server == "{{ main_server.hcloud_server.name }}" - -- name: test unassign Floating IP - hcloud_floating_ip: - name: "{{ hcloud_floating_ip_name }}" - type: ipv4 - home_location: "fsn1" - register: floatingIP -- name: verify test unassign Floating IP - assert: - that: - - floatingIP is changed - - floatingIP.hcloud_floating_ip.server != "{{ main_server.hcloud_server.name }}" - -- name: test unassign Floating IP idempotency - hcloud_floating_ip: - name: "{{ hcloud_floating_ip_name }}" - type: ipv4 - home_location: "fsn1" - register: floatingIP -- name: verify test unassign Floating IPidempotency - assert: - that: - - floatingIP is not changed - -- name: test assign Floating IP again - hcloud_floating_ip: - name: "{{ hcloud_floating_ip_name }}" - type: ipv4 - server: "{{ main_server.hcloud_server.name }}" - register: floatingIP -- name: verify test assign Floating IP again - assert: - that: - - floatingIP is changed - - floatingIP.hcloud_floating_ip.server == "{{ main_server.hcloud_server.name }}" - -- name: test already assigned Floating IP assign without force - hcloud_floating_ip: - name: "{{ hcloud_floating_ip_name }}" - type: ipv4 - server: "{{ main_server2.hcloud_server.name }}" - register: floatingIP -- name: verify test already assigned Floating IP assign without force - assert: - that: - - floatingIP is changed - - floatingIP.hcloud_floating_ip.server == "{{ main_server.hcloud_server.name }}" - -- name: test already assigned Floating IP assign with force - hcloud_floating_ip: - name: "{{ hcloud_floating_ip_name }}" - type: ipv4 - force: yes - server: "{{ main_server2.hcloud_server.name }}" - register: floatingIP -- name: verify test already assigned Floating IP assign with force - assert: - that: - - floatingIP is changed - - floatingIP.hcloud_floating_ip.server == "{{ main_server2.hcloud_server.name }}" - -- name: test update Floating IP delete protection - hcloud_floating_ip: - name: "{{ hcloud_floating_ip_name }}" - type: ipv4 - delete_protection: true - register: floatingIP -- name: verify update Floating IP delete protection - assert: - that: - - floatingIP is changed - - floatingIP.hcloud_floating_ip.delete_protection is sameas true - -- name: test update Floating IP delete protection idempotency - hcloud_floating_ip: - name: "{{ hcloud_floating_ip_name }}" - type: ipv4 - delete_protection: true - register: floatingIP -- name: verify update Floating IP delete protection idempotency - assert: - that: - - floatingIP is not changed - - floatingIP.hcloud_floating_ip.delete_protection is sameas true - -- name: test Floating IP without delete protection set to be idempotent - hcloud_floating_ip: - name: "{{ hcloud_floating_ip_name }}" - type: ipv4 - register: floatingIP -- name: verify Floating IP without delete protection set to be idempotent - assert: - that: - - floatingIP is not changed - - floatingIP.hcloud_floating_ip.delete_protection is sameas true - -- name: test delete Floating IP fails if it is protected - hcloud_floating_ip: - name: "{{ hcloud_floating_ip_name }}" - state: "absent" - register: result - ignore_errors: yes -- name: verify test delete floating ip - assert: - that: - - result is failed - - 'result.msg == "Floating IP deletion is protected"' - -- name: test update Floating IP delete protection - hcloud_floating_ip: - name: "{{ hcloud_floating_ip_name }}" - type: ipv4 - delete_protection: false - register: floatingIP -- name: verify update Floating IP delete protection - assert: - that: - - floatingIP is changed - - floatingIP.hcloud_floating_ip.delete_protection is sameas false - -- name: test delete floating ip - hcloud_floating_ip: - name: "{{ hcloud_floating_ip_name }}" - state: "absent" - register: result -- name: verify test delete floating ip - assert: - that: - - result is changed - -- name: test create ipv6 floating ip - hcloud_floating_ip: - name: "{{ hcloud_floating_ip_name }}" - type: ipv6 - home_location: "fsn1" - state: "present" - register: result -- name: verify test create ipv6 floating ip - assert: - that: - - result is changed - -- name: test delete ipv6 floating ip - hcloud_floating_ip: - name: "{{ hcloud_floating_ip_name }}" - state: "absent" - register: result -- name: verify test delete ipv6 floating ip - assert: - that: - - result is changed - -- name: cleanup - hcloud_server: - name: "{{ hcloud_server_name }}" - state: absent - register: result -- name: verify cleanup - assert: - that: - - result is changed -- name: cleanup another server - hcloud_server: - name: "{{ main_server2.hcloud_server.name }}" - state: absent - register: result -- name: verify cleanup another server - assert: - that: - - result is changed
\ No newline at end of file diff --git a/test/integration/targets/hcloud_floating_ip_info/aliases b/test/integration/targets/hcloud_floating_ip_info/aliases deleted file mode 100644 index 55ec821a47..0000000000 --- a/test/integration/targets/hcloud_floating_ip_info/aliases +++ /dev/null @@ -1,2 +0,0 @@ -cloud/hcloud -shippable/hcloud/group2 diff --git a/test/integration/targets/hcloud_floating_ip_info/defaults/main.yml b/test/integration/targets/hcloud_floating_ip_info/defaults/main.yml deleted file mode 100644 index 2a21de734b..0000000000 --- a/test/integration/targets/hcloud_floating_ip_info/defaults/main.yml +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -hcloud_prefix: "tests" -hcloud_floating_ip_name: "{{hcloud_prefix}}-integration" diff --git a/test/integration/targets/hcloud_floating_ip_info/tasks/main.yml b/test/integration/targets/hcloud_floating_ip_info/tasks/main.yml deleted file mode 100644 index 9ca1c2a4ae..0000000000 --- a/test/integration/targets/hcloud_floating_ip_info/tasks/main.yml +++ /dev/null @@ -1,87 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -- name: setup ensure floating ip is absent - hcloud_floating_ip: - name: "{{ hcloud_floating_ip_name }}" - state: absent - -- name: setup floating ip - hcloud_floating_ip: - name: "{{ hcloud_floating_ip_name }}" - home_location: "fsn1" - type: ipv4 - labels: - key: value - register: test_floating_ip - -- name: verify setup floating ip - assert: - that: - - test_floating_ip is changed - -- name: test gather hcloud floating ip infos - hcloud_floating_ip_info: - register: hcloud_floating_ips -- name: verify test gather hcloud floating ip infos - assert: - that: - - hcloud_floating_ips.hcloud_floating_ip_info| list | count >= 1 - -- name: test gather hcloud floating ip infos in check mode - hcloud_floating_ip_info: - check_mode: yes - register: hcloud_floating_ips - -- name: verify test gather hcloud floating ip infos in check mode - assert: - that: - - hcloud_floating_ips.hcloud_floating_ip_info| list | count >= 1 - - -- name: test gather hcloud floating ip infos with correct label selector - hcloud_floating_ip_info: - label_selector: "key=value" - register: hcloud_floating_ips -- name: verify test gather hcloud floating ip with correct label selector - assert: - that: - - hcloud_floating_ips.hcloud_floating_ip_info|selectattr('name','equalto','{{ test_floating_ip.hcloud_floating_ip.name }}') | list | count == 1 - -- name: test gather hcloud floating ip infos with wrong label selector - hcloud_floating_ip_info: - label_selector: "key!=value" - register: hcloud_floating_ips -- name: verify test gather hcloud floating ip with wrong label selector - assert: - that: - - hcloud_floating_ips.hcloud_floating_ip_info | list | count == 0 - -- name: test gather hcloud floating ip infos with correct id - hcloud_floating_ip_info: - id: "{{test_floating_ip.hcloud_floating_ip.id}}" - register: hcloud_floating_ips -- name: verify test gather hcloud floating ip with correct id - assert: - that: - - hcloud_floating_ips.hcloud_floating_ip_info|selectattr('name','equalto','{{ test_floating_ip.hcloud_floating_ip.name }}') | list | count == 1 - -- name: test gather hcloud floating ip infos with wrong id - hcloud_floating_ip_info: - id: "{{test_floating_ip.hcloud_floating_ip.id}}1" - register: result - ignore_errors: yes -- name: verify test gather hcloud floating ip with wrong id - assert: - that: - - result is failed - -- name: cleanup - hcloud_floating_ip: - id: "{{ test_floating_ip.hcloud_floating_ip.id }}" - state: absent - register: result -- name: verify cleanup - assert: - that: - - result is success diff --git a/test/integration/targets/hcloud_image_info/aliases b/test/integration/targets/hcloud_image_info/aliases deleted file mode 100644 index 55ec821a47..0000000000 --- a/test/integration/targets/hcloud_image_info/aliases +++ /dev/null @@ -1,2 +0,0 @@ -cloud/hcloud -shippable/hcloud/group2 diff --git a/test/integration/targets/hcloud_image_info/defaults/main.yml b/test/integration/targets/hcloud_image_info/defaults/main.yml deleted file mode 100644 index ddca3328ae..0000000000 --- a/test/integration/targets/hcloud_image_info/defaults/main.yml +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -hcloud_prefix: "tests" -hcloud_test_image_name: "always-there-snapshot" -hcloud_test_image_id: 10164049 diff --git a/test/integration/targets/hcloud_image_info/tasks/main.yml b/test/integration/targets/hcloud_image_info/tasks/main.yml deleted file mode 100644 index 503d5b7870..0000000000 --- a/test/integration/targets/hcloud_image_info/tasks/main.yml +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -- name: test gather hcloud image infos with type system - hcloud_image_info: - register: hcloud_images -- name: verify test gather hcloud image infos in check mode - assert: - that: - - hcloud_images.hcloud_image_info| list | count > 2 - -- name: test gather hcloud image infos in check mode - hcloud_image_info: - check_mode: yes - register: hcloud_images - -- name: verify test gather hcloud image infos in check mode - assert: - that: - - hcloud_images.hcloud_image_info| list | count > 2 - - -- name: test gather hcloud image infos with correct label selector - hcloud_image_info: - label_selector: "key=value" - type: snapshot - register: hcloud_images -- name: verify test gather hcloud image with correct label selector - assert: - that: - - hcloud_images.hcloud_image_info|selectattr('description','equalto','{{ hcloud_test_image_name }}') | list | count == 1 - -- name: test gather hcloud image infos with wrong label selector - hcloud_image_info: - label_selector: "key!=value" - type: snapshot - register: hcloud_images -- name: verify test gather hcloud image with wrong label selector - assert: - that: - - hcloud_images.hcloud_image_info | list | count == 0 - -- name: test gather hcloud image infos with correct id - hcloud_image_info: - id: "{{hcloud_test_image_id}}" - type: snapshot - register: hcloud_images -- name: verify test gather hcloud image with correct id - assert: - that: - - hcloud_images.hcloud_image_info|selectattr('description','equalto','{{ hcloud_test_image_name }}') | list | count == 1 - -- name: test gather hcloud image infos with wrong id - hcloud_image_info: - id: "{{hcloud_test_image_id}}1" - type: snapshot - ignore_errors: yes - register: result -- name: verify test gather hcloud image with wrong id - assert: - that: - - result is failed diff --git a/test/integration/targets/hcloud_location_info/aliases b/test/integration/targets/hcloud_location_info/aliases deleted file mode 100644 index 55ec821a47..0000000000 --- a/test/integration/targets/hcloud_location_info/aliases +++ /dev/null @@ -1,2 +0,0 @@ -cloud/hcloud -shippable/hcloud/group2 diff --git a/test/integration/targets/hcloud_location_info/defaults/main.yml b/test/integration/targets/hcloud_location_info/defaults/main.yml deleted file mode 100644 index 0d72a75c2b..0000000000 --- a/test/integration/targets/hcloud_location_info/defaults/main.yml +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -hcloud_location_name: "fsn1" -hcloud_location_id: 1 diff --git a/test/integration/targets/hcloud_location_info/tasks/main.yml b/test/integration/targets/hcloud_location_info/tasks/main.yml deleted file mode 100644 index e0ae5f176b..0000000000 --- a/test/integration/targets/hcloud_location_info/tasks/main.yml +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -- name: test gather hcloud location infos - hcloud_location_info: - register: hcloud_location - -- name: verify test gather hcloud location infos - assert: - that: - - hcloud_location.hcloud_location_info | list | count == 3 - -- name: test gather hcloud location infos in check mode - hcloud_location_info: - check_mode: yes - register: hcloud_location - -- name: verify test gather hcloud location infos in check mode - assert: - that: - - hcloud_location.hcloud_location_info | list | count == 3 - -- name: test gather hcloud location infos with correct name - hcloud_location_info: - name: "{{hcloud_location_name}}" - register: hcloud_location -- name: verify test gather hcloud location with correct name - assert: - that: - - hcloud_location.hcloud_location_info|selectattr('name','equalto','{{ hcloud_location_name }}') | list | count == 1 - -- name: test gather hcloud location infos with wrong name - hcloud_location_info: - name: "{{hcloud_location_name}}1" - register: hcloud_location -- name: verify test gather hcloud location with wrong name - assert: - that: - - hcloud_location.hcloud_location_info | list | count == 0 - -- name: test gather hcloud location infos with correct id - hcloud_location_info: - id: "{{hcloud_location_id}}" - register: hcloud_location -- name: verify test gather hcloud location with correct id - assert: - that: - - hcloud_location.hcloud_location_info|selectattr('name','equalto','{{ hcloud_location_name }}') | list | count == 1 - -- name: test gather hcloud location infos with wrong id - hcloud_location_info: - name: "4711" - register: hcloud_location -- name: verify test gather hcloud location with wrong id - assert: - that: - - hcloud_location.hcloud_location_info | list | count == 0 diff --git a/test/integration/targets/hcloud_network/aliases b/test/integration/targets/hcloud_network/aliases deleted file mode 100644 index 18dc30b6c3..0000000000 --- a/test/integration/targets/hcloud_network/aliases +++ /dev/null @@ -1,2 +0,0 @@ -cloud/hcloud -shippable/hcloud/group1 diff --git a/test/integration/targets/hcloud_network/defaults/main.yml b/test/integration/targets/hcloud_network/defaults/main.yml deleted file mode 100644 index ecfa6a73db..0000000000 --- a/test/integration/targets/hcloud_network/defaults/main.yml +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -hcloud_prefix: "tests" -hcloud_network_name: "{{hcloud_prefix}}-integ" diff --git a/test/integration/targets/hcloud_network/tasks/main.yml b/test/integration/targets/hcloud_network/tasks/main.yml deleted file mode 100644 index 32bd579fad..0000000000 --- a/test/integration/targets/hcloud_network/tasks/main.yml +++ /dev/null @@ -1,169 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -- name: setup - hcloud_network: - name: "{{ hcloud_network_name }}" - state: absent - register: result -- name: verify setup - assert: - that: - - result is success - -- name: test missing ip_range parameter on create Network - hcloud_network: - name: "{{hcloud_network_name}}" - register: result - ignore_errors: yes -- name: verify fail missing ip_range parameter on create Network result - assert: - that: - - result is failed - - 'result.msg == "missing required arguments: ip_range"' - -- name: test create Network with check mode - hcloud_network: - name: "{{hcloud_network_name}}" - ip_range: "10.0.0.0/16" - register: result - check_mode: yes -- name: verify create Network with check mode result - assert: - that: - - result is changed - -- name: test create Network - hcloud_network: - name: "{{hcloud_network_name}}" - ip_range: "10.0.0.0/16" - register: network -- name: verify test create Network result - assert: - that: - - network is changed - - network.hcloud_network.name == "{{hcloud_network_name}}" - - network.hcloud_network.ip_range == "10.0.0.0/16" - -- name: test create Network idempotence - hcloud_network: - name: "{{hcloud_network_name}}" - ip_range: "10.0.0.0/16" - register: network -- name: verify test create network - assert: - that: - - network is not changed - -- name: test update Network label - hcloud_network: - name: "{{hcloud_network_name}}" - labels: - key: value - register: network -- name: verify test update Network label - assert: - that: - - network is changed - - network.hcloud_network.labels.key == "value" - -- name: test update Network label idempotency - hcloud_network: - name: "{{hcloud_network_name}}" - labels: - key: value - register: network -- name: verify test update Network label idempotency - assert: - that: - - network is not changed - -- name: test update Network ip range - hcloud_network: - name: "{{hcloud_network_name}}" - ip_range: "10.0.0.0/8" - register: network -- name: verify test update Network ip range - assert: - that: - - network is changed - - network.hcloud_network.ip_range == "10.0.0.0/8" - -- name: test update Network ip range idempotency - hcloud_network: - name: "{{hcloud_network_name}}" - ip_range: "10.0.0.0/8" - register: network -- name: verify test update Network ip range idempotency - assert: - that: - - network is not changed - -- name: test update Network delete protection - hcloud_network: - name: "{{hcloud_network_name}}" - ip_range: "10.0.0.0/8" - delete_protection: true - register: network -- name: verify test update Network delete protection - assert: - that: - - network is changed - - network.hcloud_network.delete_protection is sameas true - -- name: test update Network delete protection idempotency - hcloud_network: - name: "{{hcloud_network_name}}" - ip_range: "10.0.0.0/8" - delete_protection: true - register: network -- name: verify test update Network delete protection idempotency - assert: - that: - - network is not changed - - network.hcloud_network.delete_protection is sameas true - -- name: test Network without delete protection set to be idempotent - hcloud_network: - name: "{{hcloud_network_name}}" - ip_range: "10.0.0.0/8" - register: network -- name: verify test Network without delete protection set to be idempotent - assert: - that: - - network is not changed - - network.hcloud_network.delete_protection is sameas true - -- name: test delete Network fails if it is protected - hcloud_network: - name: "{{hcloud_network_name}}" - state: absent - ignore_errors: yes - register: result -- name: verify delete Network - assert: - that: - - result is failed - - 'result.msg == "network deletion is protected"' - -- name: test update Network delete protection - hcloud_network: - name: "{{hcloud_network_name}}" - ip_range: "10.0.0.0/8" - delete_protection: false - register: network -- name: verify test update Network delete protection - assert: - that: - - network is changed - - network.hcloud_network.delete_protection is sameas false - -- name: test delete Network - hcloud_network: - name: "{{hcloud_network_name}}" - state: absent - register: result -- name: verify delete Network - assert: - that: - - result is success diff --git a/test/integration/targets/hcloud_network_info/aliases b/test/integration/targets/hcloud_network_info/aliases deleted file mode 100644 index 18dc30b6c3..0000000000 --- a/test/integration/targets/hcloud_network_info/aliases +++ /dev/null @@ -1,2 +0,0 @@ -cloud/hcloud -shippable/hcloud/group1 diff --git a/test/integration/targets/hcloud_network_info/defaults/main.yml b/test/integration/targets/hcloud_network_info/defaults/main.yml deleted file mode 100644 index f8a5279fba..0000000000 --- a/test/integration/targets/hcloud_network_info/defaults/main.yml +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -hcloud_prefix: "tests" -hcloud_network_name: "{{hcloud_prefix}}-integration" diff --git a/test/integration/targets/hcloud_network_info/tasks/main.yml b/test/integration/targets/hcloud_network_info/tasks/main.yml deleted file mode 100644 index e7924a8d0d..0000000000 --- a/test/integration/targets/hcloud_network_info/tasks/main.yml +++ /dev/null @@ -1,117 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- - -- name: setup ensure network is absent - hcloud_network: - name: "{{ hcloud_network_name }}" - state: absent - register: result - -- name: create network - hcloud_network: - name: "{{ hcloud_network_name }}" - ip_range: "10.0.0.0/16" - labels: - key: value - register: main_network -- name: verify create network - assert: - that: - - main_network is changed - - main_network.hcloud_network.name == "{{ hcloud_network_name }}" - - main_network.hcloud_network.ip_range == "10.0.0.0/16" -- name: create subnetwork - hcloud_subnetwork: - network: "{{ hcloud_network_name }}" - type: server - network_zone: eu-central - ip_range: "10.0.1.0/24" - register: main_subnetwork -- name: verify create subnetwork - assert: - that: - - main_subnetwork is changed - - main_subnetwork.hcloud_subnetwork.network == "{{ hcloud_network_name }}" -- name: create route - hcloud_route: - network: "{{ hcloud_network_name }}" - destination: "10.0.3.0/24" - gateway: "10.0.2.1" - register: main_route -- name: verify create route - assert: - that: - - main_route is changed - - main_route.hcloud_route.network == "{{ hcloud_network_name }}" - -- name: test gather hcloud network info in check mode - hcloud_network_info: - check_mode: yes - register: hcloud_network -- name: verify test gather hcloud network info in check mode - assert: - that: - - hcloud_network.hcloud_network_info | selectattr('name','equalto','{{ hcloud_network_name }}') | list | count >= 1 - - -- name: test gather hcloud network info with correct label selector - hcloud_network_info: - label_selector: "key=value" - register: hcloud_network -- name: verify test gather hcloud network with correct label selector - assert: - that: - - hcloud_network.hcloud_network_info | selectattr('name','equalto','{{ hcloud_network_name }}') | list | count >= 1 - -- name: test gather hcloud network info with wrong label selector - hcloud_network_info: - label_selector: "key!=value" - register: hcloud_network -- name: verify test gather hcloud network with wrong label selector - assert: - that: - - hcloud_network.hcloud_network_info | list | count == 0 - -- name: test gather hcloud network info with correct name - hcloud_network_info: - name: "{{hcloud_network_name}}" - register: hcloud_network -- name: verify test gather hcloud network with correct name - assert: - that: - - hcloud_network.hcloud_network_info | selectattr('name','equalto','{{ hcloud_network_name }}') | list | count == 1 - - hcloud_network.hcloud_network_info[0].subnetworks | list | count >= 1 - - hcloud_network.hcloud_network_info[0].routes | list | count >= 1 - -- name: test gather hcloud network info with wrong name - hcloud_network_info: - name: "{{hcloud_network_name}}1" - register: hcloud_network -- name: verify test gather hcloud network with wrong name - assert: - that: - - hcloud_network.hcloud_network_info | list | count == 0 - -- name: test gather hcloud network info with correct id - hcloud_network_info: - id: "{{main_network.hcloud_network.id}}" - register: hcloud_network -- name: verify test gather hcloud network with correct id - assert: - that: - - hcloud_network.hcloud_network_info | selectattr('name','equalto','{{ hcloud_network_name }}') | list | count == 1 - -- name: test gather hcloud network info with wrong id - hcloud_network_info: - name: "4711" - register: hcloud_network -- name: verify test gather hcloud network with wrong id - assert: - that: - - hcloud_network.hcloud_network_info | list | count == 0 - -- name: cleanup - hcloud_network: - name: "{{ hcloud_network_name }}" - state: absent diff --git a/test/integration/targets/hcloud_rdns/aliases b/test/integration/targets/hcloud_rdns/aliases deleted file mode 100644 index 18dc30b6c3..0000000000 --- a/test/integration/targets/hcloud_rdns/aliases +++ /dev/null @@ -1,2 +0,0 @@ -cloud/hcloud -shippable/hcloud/group1 diff --git a/test/integration/targets/hcloud_rdns/defaults/main.yml b/test/integration/targets/hcloud_rdns/defaults/main.yml deleted file mode 100644 index fd18be6390..0000000000 --- a/test/integration/targets/hcloud_rdns/defaults/main.yml +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -hcloud_prefix: "tests" -hcloud_server_name: "{{hcloud_prefix}}-rdns" diff --git a/test/integration/targets/hcloud_rdns/tasks/main.yml b/test/integration/targets/hcloud_rdns/tasks/main.yml deleted file mode 100644 index b3b7e4ea0e..0000000000 --- a/test/integration/targets/hcloud_rdns/tasks/main.yml +++ /dev/null @@ -1,130 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -- name: setup - hcloud_server: - name: "{{ hcloud_server_name }}" - server_type: cx11 - image: "ubuntu-18.04" - ssh_keys: - - ci@ansible.hetzner.cloud - state: present - register: setup -- name: verify setup - assert: - that: - - setup is success - -- name: test missing required parameter - hcloud_rdns: - state: present - register: result - ignore_errors: yes -- name: verify fail test missing required parameters - assert: - that: - - result is failed - - 'result.msg == "missing required arguments: ip_address, server" or result.msg == "missing required arguments: server, ip_address"' - -- name: test missing required parameters on create - hcloud_rdns: - server: "{{ hcloud_server_name }}" - ip_address: "{{ setup.hcloud_server.ipv6 | ipaddr('next_usable') }}" - state: present - register: result - ignore_errors: yes -- name: verify fail test missing required parameters on create - assert: - that: - - result is failed - - 'result.msg == "missing required arguments: dns_ptr"' - -- name: test create rdns with checkmode - hcloud_rdns: - server: "{{ hcloud_server_name }}" - ip_address: "{{ setup.hcloud_server.ipv6 | ipaddr('next_usable') }}" - dns_ptr: "example.com" - state: present - register: result - check_mode: yes -- name: verify test create rdns with checkmode - assert: - that: - - result is changed - -- name: test create rdns - hcloud_rdns: - server: "{{ hcloud_server_name }}" - ip_address: "{{ setup.hcloud_server.ipv6 | ipaddr('next_usable') }}" - dns_ptr: "example.com" - state: present - register: rdns -- name: verify create rdns - assert: - that: - - rdns is changed - - rdns.hcloud_rdns.server == "{{ hcloud_server_name }}" - - rdns.hcloud_rdns.ip_address == "{{ setup.hcloud_server.ipv6 | ipaddr('next_usable') }}" - - rdns.hcloud_rdns.dns_ptr == "example.com" - -- name: test create rdns idempotency - hcloud_rdns: - server: "{{ hcloud_server_name }}" - ip_address: "{{ setup.hcloud_server.ipv6 | ipaddr('next_usable') }}" - dns_ptr: "example.com" - state: present - register: result -- name: verify create rdns idempotency - assert: - that: - - result is not changed - -- name: test absent rdns - hcloud_rdns: - server: "{{ hcloud_server_name }}" - ip_address: "{{ setup.hcloud_server.ipv6 | ipaddr('next_usable') }}" - state: absent - register: result -- name: verify test absent rdns - assert: - that: - - result is changed - -- name: test update rdns - hcloud_rdns: - server: "{{ hcloud_server_name }}" - ip_address: "{{ setup.hcloud_server.ipv4_address }}" - dns_ptr: "example.com" - state: present - register: rdns -- name: verify update rdns - assert: - that: - - rdns is changed - - rdns.hcloud_rdns.server == "{{ hcloud_server_name }}" - - rdns.hcloud_rdns.ip_address == "{{ setup.hcloud_server.ipv4_address }}" - - rdns.hcloud_rdns.dns_ptr == "example.com" - -- name: test reset rdns - hcloud_rdns: - server: "{{ hcloud_server_name }}" - ip_address: "{{ setup.hcloud_server.ipv4_address }}" - state: present - register: rdns -- name: verify reset rdns - assert: - that: - - rdns is changed - - rdns.hcloud_rdns.server == "{{ hcloud_server_name }}" - - rdns.hcloud_rdns.ip_address == "{{ setup.hcloud_server.ipv4_address }}" - - rdns.hcloud_rdns.dns_ptr != "example.com" - -- name: cleanup - hcloud_server: - name: "{{hcloud_server_name}}" - state: absent - register: result -- name: verify cleanup - assert: - that: - - result is success diff --git a/test/integration/targets/hcloud_route/aliases b/test/integration/targets/hcloud_route/aliases deleted file mode 100644 index 18dc30b6c3..0000000000 --- a/test/integration/targets/hcloud_route/aliases +++ /dev/null @@ -1,2 +0,0 @@ -cloud/hcloud -shippable/hcloud/group1 diff --git a/test/integration/targets/hcloud_route/defaults/main.yml b/test/integration/targets/hcloud_route/defaults/main.yml deleted file mode 100644 index 62156272ad..0000000000 --- a/test/integration/targets/hcloud_route/defaults/main.yml +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -hcloud_prefix: "tests" -hcloud_network_name: "{{hcloud_prefix}}-routes" diff --git a/test/integration/targets/hcloud_route/tasks/main.yml b/test/integration/targets/hcloud_route/tasks/main.yml deleted file mode 100644 index 1894d677f3..0000000000 --- a/test/integration/targets/hcloud_route/tasks/main.yml +++ /dev/null @@ -1,99 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -- name: setup - hcloud_network: - name: "{{ hcloud_network_name }}" - ip_range: "10.0.0.0/8" - state: present - register: network -- name: verify setup - assert: - that: - - network is success - -- name: test missing required parameters on create route - hcloud_route: - state: present - register: result - ignore_errors: yes -- name: verify fail test missing required parameters on create route - assert: - that: - - result is failed - - 'result.msg == "missing required arguments: network, destination, gateway"' - -- name: test create route with checkmode - hcloud_route: - network: "{{ hcloud_network_name }}" - destination: "10.100.1.0/24" - gateway: "10.0.1.1" - state: present - register: result - check_mode: yes -- name: verify test create route with checkmode - assert: - that: - - result is changed - -- name: test create route - hcloud_route: - network: "{{ hcloud_network_name }}" - destination: "10.100.1.0/24" - gateway: "10.0.1.1" - state: present - register: route -- name: verify create route - assert: - that: - - route is changed - - route.hcloud_route.network == "{{ hcloud_network_name }}" - - route.hcloud_route.destination == "10.100.1.0/24" - - route.hcloud_route.gateway == "10.0.1.1" - -- name: test create route idempotency - hcloud_route: - network: "{{ hcloud_network_name }}" - destination: "10.100.1.0/24" - gateway: "10.0.1.1" - state: present - register: result -- name: verify create route idempotency - assert: - that: - - result is not changed - -- name: test fail create route with wrong gateway - hcloud_route: - network: "{{ hcloud_network_name }}" - destination: "10.100.1.0/24" - gateway: "10.0.1.2" - state: present - register: route - ignore_errors: yes -- name: verfiy fail create route with wrong gateway - assert: - that: - - route is failed - -- name: test absent route - hcloud_route: - network: "{{ hcloud_network_name }}" - destination: "10.100.1.0/24" - gateway: "10.0.1.1" - state: absent - register: result -- name: verify test absent route - assert: - that: - - result is changed - -- name: cleanup - hcloud_network: - name: "{{hcloud_network_name}}" - state: absent - register: result -- name: verify cleanup - assert: - that: - - result is success diff --git a/test/integration/targets/hcloud_server/aliases b/test/integration/targets/hcloud_server/aliases deleted file mode 100644 index 18dc30b6c3..0000000000 --- a/test/integration/targets/hcloud_server/aliases +++ /dev/null @@ -1,2 +0,0 @@ -cloud/hcloud -shippable/hcloud/group1 diff --git a/test/integration/targets/hcloud_server/defaults/main.yml b/test/integration/targets/hcloud_server/defaults/main.yml deleted file mode 100644 index b9a9a8df7b..0000000000 --- a/test/integration/targets/hcloud_server/defaults/main.yml +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -hcloud_prefix: "tests" -hcloud_server_name: "{{hcloud_prefix}}-integration" diff --git a/test/integration/targets/hcloud_server/tasks/main.yml b/test/integration/targets/hcloud_server/tasks/main.yml deleted file mode 100644 index 945df73020..0000000000 --- a/test/integration/targets/hcloud_server/tasks/main.yml +++ /dev/null @@ -1,565 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -- name: setup - hcloud_server: - name: "{{ hcloud_server_name }}" - state: absent - register: result -- name: verify setup - assert: - that: - - result is success -- name: test missing required parameters on create server - hcloud_server: - name: "{{ hcloud_server_name }}" - register: result - ignore_errors: yes -- name: verify fail test missing required parameters on create server - assert: - that: - - result is failed - - 'result.msg == "missing required arguments: server_type, image"' - -- name: test create server with check mode - hcloud_server: - name: "{{ hcloud_server_name }}" - server_type: cx11 - image: ubuntu-18.04 - state: present - register: result - check_mode: yes -- name: test create server server - assert: - that: - - result is changed - -- name: test create server - hcloud_server: - name: "{{ hcloud_server_name}}" - server_type: cx11 - image: ubuntu-18.04 - state: started - register: main_server -- name: verify create server - assert: - that: - - main_server is changed - - main_server.hcloud_server.name == "{{ hcloud_server_name }}" - - main_server.hcloud_server.server_type == "cx11" - - main_server.hcloud_server.status == "running" - - main_server.root_password != "" - -- name: test create server idempotence - hcloud_server: - name: "{{ hcloud_server_name }}" - state: started - register: result -- name: verify create server idempotence - assert: - that: - - result is not changed - -- name: test stop server with check mode - hcloud_server: - name: "{{ hcloud_server_name }}" - state: stopped - register: result - check_mode: yes -- name: verify stop server with check mode - assert: - that: - - result is changed - - result.hcloud_server.status == "running" - -- name: test stop server - hcloud_server: - name: "{{ hcloud_server_name }}" - state: stopped - register: result -- name: verify stop server - assert: - that: - - result is changed - - result.hcloud_server.status == "off" - -- name: test start server with check mode - hcloud_server: - name: "{{ hcloud_server_name }}" - state: started - register: result - check_mode: true -- name: verify start server with check mode - assert: - that: - - result is changed - -- name: test start server - hcloud_server: - name: "{{ hcloud_server_name }}" - state: started - register: result -- name: verify start server - assert: - that: - - result is changed - - result.hcloud_server.status == "running" - -- name: test start server idempotence - hcloud_server: - name: "{{ hcloud_server_name }}" - state: started - register: result -- name: verify start server idempotence - assert: - that: - - result is not changed - - result.hcloud_server.status == "running" - -- name: test stop server by its id - hcloud_server: - id: "{{ main_server.hcloud_server.id }}" - state: stopped - register: result -- name: verify stop server by its id - assert: - that: - - result is changed - - result.hcloud_server.status == "off" - -- name: test resize server running without force - hcloud_server: - name: "{{ hcloud_server_name }}" - server_type: "cx21" - state: present - register: result - check_mode: true -- name: verify test resize server running without force - assert: - that: - - result is changed - - result.hcloud_server.server_type == "cx11" - -- name: test resize server with check mode - hcloud_server: - name: "{{ hcloud_server_name }}" - server_type: "cx21" - state: stopped - register: result - check_mode: true -- name: verify resize server with check mode - assert: - that: - - result is changed - -- name: test resize server without disk - hcloud_server: - name: "{{ hcloud_server_name }}" - server_type: "cx21" - state: stopped - register: result -- name: verify resize server without disk - assert: - that: - - result is changed - - result.hcloud_server.server_type == "cx21" - -- name: test resize server idempotence - hcloud_server: - name: "{{ hcloud_server_name }}" - server_type: "cx21" - state: stopped - register: result -- name: verify resize server idempotence - assert: - that: - - result is not changed - -- name: test resize server to smaller plan - hcloud_server: - name: "{{ hcloud_server_name }}" - server_type: "cx11" - state: stopped - register: result -- name: verify resize server to smaller plan - assert: - that: - - result is changed - - result.hcloud_server.server_type == "cx11" - -- name: test resize server with disk - hcloud_server: - name: "{{ hcloud_server_name }}" - server_type: "cx21" - upgrade_disk: true - state: stopped - register: result -- name: verify resize server with disk - assert: - that: - - result is changed - - result.hcloud_server.server_type == "cx21" - -- name: test enable backups with check mode - hcloud_server: - name: "{{ hcloud_server_name }}" - backups: true - state: stopped - register: result - check_mode: true -- name: verify enable backups with check mode - assert: - that: - - result is changed - -- name: test enable backups - hcloud_server: - name: "{{ hcloud_server_name }}" - backups: true - state: stopped - register: result -- name: verify enable backups - assert: - that: - - result is changed - - result.hcloud_server.backup_window != "" - -- name: test enable backups idempotence - hcloud_server: - name: "{{ hcloud_server_name }}" - backups: true - state: stopped - register: result -- name: verify enable backups idempotence - assert: - that: - - result is not changed - - result.hcloud_server.backup_window != "" - -- name: test rebuild server - hcloud_server: - name: "{{ hcloud_server_name }}" - image: ubuntu-18.04 - state: rebuild - register: result_after_test -- name: verify rebuild server - assert: - that: - - result_after_test is changed - - result.hcloud_server.id == result_after_test.hcloud_server.id - -- name: test rebuild server with check mode - hcloud_server: - name: "{{ hcloud_server_name }}" - image: ubuntu-18.04 - state: rebuild - register: result_after_test - check_mode: true -- name: verify rebuild server with check mode - assert: - that: - - result_after_test is changed - -- name: test update server protection booth protection arguments are required - hcloud_server: - name: "{{ hcloud_server_name }}" - delete_protection: true - state: present - register: result_after_test - ignore_errors: true -- name: verify update server protection booth protection arguments are required - assert: - that: - - result_after_test is failed - - 'result_after_test.msg == "parameters are required together: delete_protection, rebuild_protection"' - -- name: test update server protection fails if they are not the same - hcloud_server: - name: "{{ hcloud_server_name }}" - delete_protection: true - rebuild_protection: false - state: present - register: result_after_test - ignore_errors: true -- name: verify update server protection fails if they are not the same - assert: - that: - - result_after_test is failed - -- name: test update server protection - hcloud_server: - name: "{{ hcloud_server_name }}" - delete_protection: true - rebuild_protection: true - state: present - register: result_after_test - ignore_errors: true -- name: verify update server protection - assert: - that: - - result_after_test is changed - - result_after_test.hcloud_server.delete_protection is sameas true - - result_after_test.hcloud_server.rebuild_protection is sameas true - -- name: test server without protection set to be idempotent - hcloud_server: - name: "{{hcloud_server_name}}" - register: result_after_test -- name: verify test server without protection set to be idempotent - assert: - that: - - result_after_test is not changed - - result_after_test.hcloud_server.delete_protection is sameas true - - result_after_test.hcloud_server.rebuild_protection is sameas true - -- name: test delete server fails if it is protected - hcloud_server: - name: "{{hcloud_server_name}}" - state: absent - ignore_errors: yes - register: result -- name: verify delete server fails if it is protected - assert: - that: - - result is failed - - 'result.msg == "server deletion is protected"' - -- name: test rebuild server fails if it is protected - hcloud_server: - name: "{{hcloud_server_name}}" - image: ubuntu-18.04 - state: rebuild - ignore_errors: yes - register: result -- name: verify rebuild server fails if it is protected - assert: - that: - - result is failed - - 'result.msg == "server rebuild is protected"' - -- name: test remove server protection - hcloud_server: - name: "{{ hcloud_server_name }}" - delete_protection: false - rebuild_protection: false - state: present - register: result_after_test - ignore_errors: true -- name: verify remove server protection - assert: - that: - - result_after_test is changed - - result_after_test.hcloud_server.delete_protection is sameas false - - result_after_test.hcloud_server.rebuild_protection is sameas false - -- name: absent server - hcloud_server: - name: "{{ hcloud_server_name }}" - state: absent - register: result -- name: verify absent server - assert: - that: - - result is success - -- name: test create server with ssh key - hcloud_server: - name: "{{ hcloud_server_name}}" - server_type: cx11 - image: "ubuntu-18.04" - ssh_keys: - - ci@ansible.hetzner.cloud - state: started - register: main_server -- name: verify create server with ssh key - assert: - that: - - main_server is changed - - main_server.hcloud_server.name == "{{ hcloud_server_name }}" - - main_server.hcloud_server.server_type == "cx11" - - main_server.hcloud_server.status == "running" - - main_server.root_password != "" - -- name: absent server - hcloud_server: - name: "{{ hcloud_server_name }}" - state: absent - register: result -- name: verify absent server - assert: - that: - - result is success - -- name: test create server with rescue_mode - hcloud_server: - name: "{{ hcloud_server_name}}" - server_type: cx11 - image: "ubuntu-18.04" - ssh_keys: - - ci@ansible.hetzner.cloud - rescue_mode: "linux64" - state: started - register: main_server -- name: verify create server with rescue_mode - assert: - that: - - main_server is changed - - main_server.hcloud_server.name == "{{ hcloud_server_name }}" - - main_server.hcloud_server.server_type == "cx11" - - main_server.hcloud_server.status == "running" - - main_server.root_password != "" - - main_server.hcloud_server.rescue_enabled is sameas true - -- name: absent server - hcloud_server: - name: "{{ hcloud_server_name }}" - state: absent - register: result -- name: verify absent server - assert: - that: - - result is success - -- name: setup server - hcloud_server: - name: "{{ hcloud_server_name}}" - server_type: cx11 - image: ubuntu-18.04 - state: started - register: main_server -- name: verify setup server - assert: - that: - - main_server is changed - - main_server.hcloud_server.name == "{{ hcloud_server_name }}" - - main_server.hcloud_server.server_type == "cx11" - - main_server.hcloud_server.status == "running" - - main_server.root_password != "" - -- name: test activate rescue mode with check_mode - hcloud_server: - name: "{{ hcloud_server_name }}" - rescue_mode: "linux64" - ssh_keys: - - ci@ansible.hetzner.cloud - state: present - register: main_server - check_mode: true -- name: verify activate rescue mode - assert: - that: - - main_server is changed - -- name: test activate rescue mode - hcloud_server: - name: "{{ hcloud_server_name }}" - rescue_mode: "linux64" - ssh_keys: - - ci@ansible.hetzner.cloud - state: present - register: main_server -- name: verify activate rescue mode - assert: - that: - - main_server is changed - - main_server.hcloud_server.rescue_enabled is sameas true - -- name: test disable rescue mode - hcloud_server: - name: "{{ hcloud_server_name }}" - ssh_keys: - - ci@ansible.hetzner.cloud - state: present - register: main_server -- name: verify activate rescue mode - assert: - that: - - main_server is changed - - main_server.hcloud_server.rescue_enabled is sameas false - -- name: test activate rescue mode without ssh keys - hcloud_server: - name: "{{ hcloud_server_name }}" - rescue_mode: "linux64" - state: present - register: main_server -- name: verify activate rescue mode without ssh keys - assert: - that: - - main_server is changed - - main_server.hcloud_server.rescue_enabled is sameas true - -- name: cleanup - hcloud_server: - name: "{{ hcloud_server_name }}" - state: absent - register: result -- name: verify cleanup - assert: - that: - - result is success - -- name: test create server with labels - hcloud_server: - name: "{{ hcloud_server_name}}" - server_type: cx11 - image: "ubuntu-18.04" - ssh_keys: - - ci@ansible.hetzner.cloud - labels: - key: value - mylabel: "val123" - state: started - register: main_server -- name: verify create server with labels - assert: - that: - - main_server is changed - - main_server.hcloud_server.labels.key == "value" - - main_server.hcloud_server.labels.mylabel == "val123" - -- name: test update server with labels - hcloud_server: - name: "{{ hcloud_server_name}}" - server_type: cx11 - image: "ubuntu-18.04" - ssh_keys: - - ci@ansible.hetzner.cloud - labels: - key: other - mylabel: "val123" - state: started - register: main_server -- name: verify update server with labels - assert: - that: - - main_server is changed - - main_server.hcloud_server.labels.key == "other" - - main_server.hcloud_server.labels.mylabel == "val123" - -- name: test update server with labels in other order - hcloud_server: - name: "{{ hcloud_server_name}}" - server_type: cx11 - image: "ubuntu-18.04" - ssh_keys: - - ci@ansible.hetzner.cloud - labels: - mylabel: "val123" - key: other - state: started - register: main_server -- name: verify update server with labels in other order - assert: - that: - - main_server is not changed - -- name: cleanup with labels - hcloud_server: - name: "{{ hcloud_server_name }}" - state: absent - register: result -- name: verify cleanup - assert: - that: - - result is success diff --git a/test/integration/targets/hcloud_server_info/aliases b/test/integration/targets/hcloud_server_info/aliases deleted file mode 100644 index 55ec821a47..0000000000 --- a/test/integration/targets/hcloud_server_info/aliases +++ /dev/null @@ -1,2 +0,0 @@ -cloud/hcloud -shippable/hcloud/group2 diff --git a/test/integration/targets/hcloud_server_info/defaults/main.yml b/test/integration/targets/hcloud_server_info/defaults/main.yml deleted file mode 100644 index b9a9a8df7b..0000000000 --- a/test/integration/targets/hcloud_server_info/defaults/main.yml +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -hcloud_prefix: "tests" -hcloud_server_name: "{{hcloud_prefix}}-integration" diff --git a/test/integration/targets/hcloud_server_info/tasks/main.yml b/test/integration/targets/hcloud_server_info/tasks/main.yml deleted file mode 100644 index 92eac5cc56..0000000000 --- a/test/integration/targets/hcloud_server_info/tasks/main.yml +++ /dev/null @@ -1,97 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -- name: setup ensure server is absent - hcloud_server: - name: "{{ hcloud_server_name }}" - state: absent - register: result - -- name: create server - hcloud_server: - name: "{{ hcloud_server_name }}" - server_type: cx11 - image: ubuntu-18.04 - state: started - labels: - key: value - register: main_server -- name: verify create server - assert: - that: - - main_server is changed - - main_server.hcloud_server.name == "{{ hcloud_server_name }}" - - main_server.hcloud_server.server_type == "cx11" - - main_server.hcloud_server.status == "running" - - main_server.root_password != "" - - -- name: test gather hcloud server infos in check mode - hcloud_server_info: - register: hcloud_server - check_mode: yes - -- name: verify test gather hcloud server infos in check mode - assert: - that: - - hcloud_server.hcloud_server_info|selectattr('name','equalto','{{ hcloud_server_name }}') | list | count == 1 - - -- name: test gather hcloud server infos with correct label selector - hcloud_server_info: - label_selector: "key=value" - register: hcloud_server -- name: verify test gather hcloud server infos with correct label selector - assert: - that: - - hcloud_server.hcloud_server_info|selectattr('name','equalto','{{ hcloud_server_name }}') | list | count == 1 - -- name: test gather hcloud server infos with wrong label selector - hcloud_server_info: - label_selector: "key!=value" - register: hcloud_server -- name: verify test gather hcloud server infos with wrong label selector - assert: - that: - - hcloud_server.hcloud_server_info | list | count == 0 - -- name: test gather hcloud server infos with correct name - hcloud_server_info: - name: "{{hcloud_server_name}}" - register: hcloud_server -- name: verify test gather hcloud server infos with correct name - assert: - that: - - hcloud_server.hcloud_server_info|selectattr('name','equalto','{{ hcloud_server_name }}') | list | count == 1 - -- name: test gather hcloud server infos with wrong name - hcloud_server_info: - name: "{{hcloud_server_name}}1" - register: hcloud_server -- name: verify test gather hcloud server infos with wrong name - assert: - that: - - hcloud_server.hcloud_server_info | list | count == 0 - -- name: test gather hcloud server infos with correct id - hcloud_server_info: - id: "{{main_server.hcloud_server.id}}" - register: hcloud_server -- name: verify test gather hcloud server infos with correct id - assert: - that: - - hcloud_server.hcloud_server_info|selectattr('name','equalto','{{ hcloud_server_name }}') | list | count == 1 - -- name: test gather hcloud server infos with wrong id - hcloud_server_info: - name: "4711" - register: hcloud_server -- name: verify test gather hcloud server infos with wrong id - assert: - that: - - hcloud_server.hcloud_server_info | list | count == 0 - -- name: cleanup - hcloud_server: - name: "{{ hcloud_server_name }}" - state: absent diff --git a/test/integration/targets/hcloud_server_network/aliases b/test/integration/targets/hcloud_server_network/aliases deleted file mode 100644 index 55ec821a47..0000000000 --- a/test/integration/targets/hcloud_server_network/aliases +++ /dev/null @@ -1,2 +0,0 @@ -cloud/hcloud -shippable/hcloud/group2 diff --git a/test/integration/targets/hcloud_server_network/defaults/main.yml b/test/integration/targets/hcloud_server_network/defaults/main.yml deleted file mode 100644 index 1d62e5dc2d..0000000000 --- a/test/integration/targets/hcloud_server_network/defaults/main.yml +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -hcloud_prefix: "tests" -hcloud_network_name: "{{hcloud_prefix}}-server-network" -hcloud_server_name: "{{hcloud_prefix}}-server-network" diff --git a/test/integration/targets/hcloud_server_network/tasks/main.yml b/test/integration/targets/hcloud_server_network/tasks/main.yml deleted file mode 100644 index 43235d73ee..0000000000 --- a/test/integration/targets/hcloud_server_network/tasks/main.yml +++ /dev/null @@ -1,187 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -- name: setup network - hcloud_network: - name: "{{ hcloud_network_name }}" - ip_range: "10.0.0.0/8" - state: present - register: network -- name: verify setup network - assert: - that: - - network is success - -- name: setup subnetwork - hcloud_subnetwork: - network: "{{ hcloud_network_name }}" - ip_range: "10.0.0.0/16" - type: "server" - network_zone: "eu-central" - state: present - register: subnetwork -- name: verify subnetwork - assert: - that: - - subnetwork is success - -- name: setup server - hcloud_server: - name: "{{hcloud_server_name}}" - server_type: cx11 - image: ubuntu-18.04 - state: started - location: "fsn1" - register: server -- name: verify setup server - assert: - that: - - server is success - -- name: test missing required parameters on create server network - hcloud_server_network: - state: present - register: result - ignore_errors: yes -- name: verify fail test missing required parameters on create server network - assert: - that: - - result is failed - - 'result.msg == "missing required arguments: network, server"' - -- name: test create server network with checkmode - hcloud_server_network: - network: "{{ hcloud_network_name }}" - server: "{{hcloud_server_name}}" - state: present - register: result - check_mode: yes -- name: verify test create server network with checkmode - assert: - that: - - result is changed - -- name: test create server network - hcloud_server_network: - network: "{{ hcloud_network_name }}" - server: "{{hcloud_server_name}}" - state: present - register: serverNetwork -- name: verify create server network - assert: - that: - - serverNetwork is changed - - serverNetwork.hcloud_server_network.network == hcloud_network_name - - serverNetwork.hcloud_server_network.server == hcloud_server_name - -- name: test create server network idempotency - hcloud_server_network: - network: "{{ hcloud_network_name }}" - server: "{{hcloud_server_name}}" - state: present - register: serverNetwork -- name: verify create server network idempotency - assert: - that: - - serverNetwork is not changed - -- name: test absent server network - hcloud_server_network: - network: "{{ hcloud_network_name }}" - server: "{{hcloud_server_name}}" - state: absent - register: result -- name: verify test absent server network - assert: - that: - - result is changed - -- name: test create server network with specified ip - hcloud_server_network: - network: "{{ hcloud_network_name }}" - server: "{{hcloud_server_name}}" - ip: "10.0.0.2" - state: present - register: serverNetwork -- name: verify create server network with specified ip - assert: - that: - - serverNetwork is changed - - serverNetwork.hcloud_server_network.network == hcloud_network_name - - serverNetwork.hcloud_server_network.server == hcloud_server_name - - serverNetwork.hcloud_server_network.ip == "10.0.0.2" - -- name: cleanup create server network with specified ip - hcloud_server_network: - network: "{{ hcloud_network_name }}" - server: "{{hcloud_server_name}}" - state: absent - register: result -- name: verify cleanup create server network with specified ip - assert: - that: - - result is changed - -- name: test create server network with alias ips - hcloud_server_network: - network: "{{ hcloud_network_name }}" - server: "{{hcloud_server_name}}" - ip: "10.0.0.2" - alias_ips: - - "10.0.1.2" - - "10.0.2.3" - state: present - register: serverNetwork -- name: verify create server network with alias ips - assert: - that: - - serverNetwork is changed - - serverNetwork.hcloud_server_network.network == hcloud_network_name - - serverNetwork.hcloud_server_network.server == hcloud_server_name - - serverNetwork.hcloud_server_network.ip == "10.0.0.2" - - 'serverNetwork.hcloud_server_network.alias_ips[0] == "10.0.2.3"' - - 'serverNetwork.hcloud_server_network.alias_ips[1] == "10.0.1.2"' - -- name: cleanup create server network with alias ips - hcloud_server_network: - network: "{{ hcloud_network_name }}" - server: "{{hcloud_server_name}}" - state: absent - register: result -- name: verify cleanup create server network with alias ips - assert: - that: - - result is changed - -- name: cleanup server - hcloud_server: - name: "{{ hcloud_server_name }}" - state: absent - register: result -- name: verify cleanup server - assert: - that: - - result is success - -- name: cleanup subnetwork - hcloud_subnetwork: - network: "{{ hcloud_network_name }}" - ip_range: "10.0.0.0/16" - type: "server" - network_zone: "eu-central" - state: absent - register: result -- name: verify cleanup subnetwork - assert: - that: - - result is changed - -- name: cleanup - hcloud_network: - name: "{{hcloud_network_name}}" - state: absent - register: result -- name: verify cleanup - assert: - that: - - result is success diff --git a/test/integration/targets/hcloud_server_type_info/aliases b/test/integration/targets/hcloud_server_type_info/aliases deleted file mode 100644 index 55ec821a47..0000000000 --- a/test/integration/targets/hcloud_server_type_info/aliases +++ /dev/null @@ -1,2 +0,0 @@ -cloud/hcloud -shippable/hcloud/group2 diff --git a/test/integration/targets/hcloud_server_type_info/defaults/main.yml b/test/integration/targets/hcloud_server_type_info/defaults/main.yml deleted file mode 100644 index 05502aa91b..0000000000 --- a/test/integration/targets/hcloud_server_type_info/defaults/main.yml +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -hcloud_server_type_name: "cx11" -hcloud_server_type_id: 1 diff --git a/test/integration/targets/hcloud_server_type_info/tasks/main.yml b/test/integration/targets/hcloud_server_type_info/tasks/main.yml deleted file mode 100644 index 3c1fce8c0e..0000000000 --- a/test/integration/targets/hcloud_server_type_info/tasks/main.yml +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -- name: test gather hcloud server type infos - hcloud_server_type_info: - register: hcloud_server_types -- name: verify test gather hcloud server type infos - assert: - that: - - hcloud_server_types.hcloud_server_type_info| list | count > 2 - -- name: test gather hcloud server type infos in check mode - hcloud_server_type_info: - check_mode: yes - register: hcloud_server_types - -- name: verify test gather hcloud server type infos in check mode - assert: - that: - - hcloud_server_types.hcloud_server_type_info| list | count > 2 - -- name: test gather hcloud server type infos with name - hcloud_server_type_info: - name: "{{hcloud_server_type_name}}" - register: hcloud_server_types -- name: verify test gather hcloud server type with name - assert: - that: - - hcloud_server_types.hcloud_server_type_info|selectattr('name','equalto','{{ hcloud_server_type_name }}') | list | count == 1 - -- name: test gather hcloud server type infos with correct id - hcloud_server_type_info: - id: "{{hcloud_server_type_id}}" - register: hcloud_server_types -- name: verify test gather hcloud server type with correct id - assert: - that: - - hcloud_server_types.hcloud_server_type_info|selectattr('name','equalto','{{ hcloud_server_type_name }}') | list | count == 1 diff --git a/test/integration/targets/hcloud_ssh_key/aliases b/test/integration/targets/hcloud_ssh_key/aliases deleted file mode 100644 index 55ec821a47..0000000000 --- a/test/integration/targets/hcloud_ssh_key/aliases +++ /dev/null @@ -1,2 +0,0 @@ -cloud/hcloud -shippable/hcloud/group2 diff --git a/test/integration/targets/hcloud_ssh_key/defaults/main.yml b/test/integration/targets/hcloud_ssh_key/defaults/main.yml deleted file mode 100644 index 666d33469f..0000000000 --- a/test/integration/targets/hcloud_ssh_key/defaults/main.yml +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -hcloud_prefix: "tests" -hcloud_server_name: "{{hcloud_prefix}}-integration" -hcloud_ssh_key_name: "{{hcloud_prefix}}-integration" -hcloud_ssh_key_public_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDnaTPfKaX1QKcRLOfr34buVLh5FhJAThI9NYB0xNdXsMd4Y0zLyyCQzHbx4eWCVZxym/s6csWSeLaAhO1GOHeAw3hQFMqf1oTBx6Y8g0pKpeotKPa/PDSUzdZF9Lc+DadtpQd8kFVHAu1Kd3zoEUnk1u6kP7I4qu4Z/6F9qBDF+M3aobiPVxdS7GwaVRW3nZu+FcQDLiBiNOjuRDyjHcDfEUkoh2SOu25RrFtGPzFu5mGmBJwotKpWAocLGfHzyn/fAHxgw3jKZVH/t+XWQFnl82Ie8yE3Z1EZ7oDkNRqFQT9AdXEQOLycTTYTQMJZpgeFTv3sAo6lPRCusiFmmLcf ci@ansible.hetzner.cloud" -hcloud_ssh_key_fingerprint: "56:89:c4:d6:a7:4a:79:82:f4:c2:58:9c:e1:d2:2d:4e" diff --git a/test/integration/targets/hcloud_ssh_key/meta/main.yml b/test/integration/targets/hcloud_ssh_key/meta/main.yml deleted file mode 100644 index 7e4c5b7eb4..0000000000 --- a/test/integration/targets/hcloud_ssh_key/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - setup_sshkey diff --git a/test/integration/targets/hcloud_ssh_key/tasks/main.yml b/test/integration/targets/hcloud_ssh_key/tasks/main.yml deleted file mode 100644 index baaadd4db4..0000000000 --- a/test/integration/targets/hcloud_ssh_key/tasks/main.yml +++ /dev/null @@ -1,144 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -- name: test missing required parameters on create ssh_key - hcloud_ssh_key: - name: "{{ hcloud_ssh_key_name }}" - register: result - ignore_errors: yes -- name: verify fail test missing required parameters on create ssh_key - assert: - that: - - result is failed - - 'result.msg == "missing required arguments: public_key"' - -- name: test create ssh key with check mode - hcloud_ssh_key: - name: "{{ hcloud_ssh_key_name }}" - public_key: "{{ key_material }}" - register: result - check_mode: yes -- name: test create ssh key with check mode - assert: - that: - - result is changed - -- name: test create ssh key - hcloud_ssh_key: - name: "{{ hcloud_ssh_key_name }}" - public_key: "{{ key_material }}" - labels: - key: value - my-label: label - register: sshKey -- name: verify create ssh key - assert: - that: - - sshKey is changed - - sshKey.hcloud_ssh_key.name == "{{ hcloud_ssh_key_name }}" - - sshKey.hcloud_ssh_key.public_key == "{{ key_material }}" - - sshKey.hcloud_ssh_key.labels.key == "value" - -- name: test create ssh key idempotence - hcloud_ssh_key: - name: "{{ hcloud_ssh_key_name }}" - public_key: "{{ key_material }}" - register: result -- name: verify create ssh key idempotence - assert: - that: - - result is not changed - -- name: test update ssh key with check mode - hcloud_ssh_key: - id: "{{ sshKey.hcloud_ssh_key.id }}" - name: "changed-{{ hcloud_ssh_key_name }}" - register: result - check_mode: yes -- name: test create ssh key with check mode - assert: - that: - - result is changed - -- name: test update ssh key - hcloud_ssh_key: - id: "{{ sshKey.hcloud_ssh_key.id }}" - name: "changed-{{ hcloud_ssh_key_name }}" - labels: - key: value - register: result -- name: test update ssh key - assert: - that: - - result is changed - - result.hcloud_ssh_key.name == "changed-{{ hcloud_ssh_key_name }}" - -- name: test update ssh key with same labels - hcloud_ssh_key: - id: "{{ sshKey.hcloud_ssh_key.id }}" - name: "changed-{{ hcloud_ssh_key_name }}" - labels: - key: value - register: result -- name: test update ssh key with same labels - assert: - that: - - result is not changed - -- name: test update ssh key with other labels - hcloud_ssh_key: - id: "{{ sshKey.hcloud_ssh_key.id }}" - name: "changed-{{ hcloud_ssh_key_name }}" - labels: - key: value - test: "val123" - register: result -- name: test update ssh key with other labels - assert: - that: - - result is changed - -- name: test rename ssh key - hcloud_ssh_key: - id: "{{ sshKey.hcloud_ssh_key.id }}" - name: "{{ hcloud_ssh_key_name }}" - register: result -- name: test rename ssh key - assert: - that: - - result is changed - - result.hcloud_ssh_key.name == "{{ hcloud_ssh_key_name }}" - -- name: test create server with ssh key - hcloud_server: - name: "{{ hcloud_server_name }}" - server_type: cx11 - image: "ubuntu-18.04" - ssh_keys: - - "{{ hcloud_ssh_key_name }}" - state: started - register: main_server -- name: verify create server with ssh key - assert: - that: - - main_server is changed - -- name: absent ssh key - hcloud_ssh_key: - id: "{{ sshKey.hcloud_ssh_key.id }}" - state: absent - register: result -- name: verify absent server - assert: - that: - - result is success - -- name: cleanup - hcloud_server: - name: "{{ hcloud_server_name }}" - state: absent - register: result -- name: verify cleanup - assert: - that: - - result is success diff --git a/test/integration/targets/hcloud_ssh_key_info/aliases b/test/integration/targets/hcloud_ssh_key_info/aliases deleted file mode 100644 index 55ec821a47..0000000000 --- a/test/integration/targets/hcloud_ssh_key_info/aliases +++ /dev/null @@ -1,2 +0,0 @@ -cloud/hcloud -shippable/hcloud/group2 diff --git a/test/integration/targets/hcloud_ssh_key_info/defaults/main.yml b/test/integration/targets/hcloud_ssh_key_info/defaults/main.yml deleted file mode 100644 index 06c1471ad3..0000000000 --- a/test/integration/targets/hcloud_ssh_key_info/defaults/main.yml +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -hcloud_prefix: "tests" -hcloud_ssh_key_name: "{{hcloud_prefix}}-ssh_key_facts" diff --git a/test/integration/targets/hcloud_ssh_key_info/meta/main.yml b/test/integration/targets/hcloud_ssh_key_info/meta/main.yml deleted file mode 100644 index 7e4c5b7eb4..0000000000 --- a/test/integration/targets/hcloud_ssh_key_info/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - setup_sshkey diff --git a/test/integration/targets/hcloud_ssh_key_info/tasks/main.yml b/test/integration/targets/hcloud_ssh_key_info/tasks/main.yml deleted file mode 100644 index 87cbd26264..0000000000 --- a/test/integration/targets/hcloud_ssh_key_info/tasks/main.yml +++ /dev/null @@ -1,68 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- - -- name: setup ensure ssh key is absent - hcloud_ssh_key: - name: "{{ hcloud_ssh_key_name }}" - state: absent - register: result - -- name: setup test ssh_key - hcloud_ssh_key: - name: "{{hcloud_ssh_key_name}}" - public_key: "{{ key_material }}" - labels: - key: value - register: result -- name: verify create test ssh_key - assert: - that: - - result is changed - - result.hcloud_ssh_key.public_key == "{{ key_material }}" - -- name: test gather hcloud ssh key infos in check mode - hcloud_ssh_key_info: - register: hcloud_ssh_key - check_mode: yes -- name: verify test gather hcloud ssh key infos in check mode - assert: - that: - - hcloud_ssh_key.hcloud_ssh_key_info| list | count >= 1 - -- name: test gather hcloud ssh key infos - hcloud_ssh_key_info: - register: hcloud_ssh_key - check_mode: yes -- name: verify test gather hcloud ssh key infos - assert: - that: - - hcloud_ssh_key.hcloud_ssh_key_info| list | count >= 1 - -- name: test gather hcloud ssh key infos with correct label selector - hcloud_ssh_key_info: - label_selector: "key=value" - register: hcloud_ssh_key -- name: verify test gather hcloud ssh key infos with correct label selector - assert: - that: - - hcloud_ssh_key.hcloud_ssh_key_info|selectattr('name','equalto','{{ hcloud_ssh_key_name }}') | list | count == 1 - -- name: test gather hcloud ssh key infos with wrong label selector - hcloud_ssh_key_info: - label_selector: "key!=value" - register: hcloud_ssh_key -- name: verify test gather hcloud ssh key infos with wrong label selector - assert: - that: - - hcloud_ssh_key.hcloud_ssh_key_info | list | count == 0 - -- name: cleanup - hcloud_ssh_key: - name: "{{hcloud_ssh_key_name}}" - state: absent - register: result -- name: verify cleanup - assert: - that: - - result is success diff --git a/test/integration/targets/hcloud_subnetwork/aliases b/test/integration/targets/hcloud_subnetwork/aliases deleted file mode 100644 index 55ec821a47..0000000000 --- a/test/integration/targets/hcloud_subnetwork/aliases +++ /dev/null @@ -1,2 +0,0 @@ -cloud/hcloud -shippable/hcloud/group2 diff --git a/test/integration/targets/hcloud_subnetwork/defaults/main.yml b/test/integration/targets/hcloud_subnetwork/defaults/main.yml deleted file mode 100644 index bba960f244..0000000000 --- a/test/integration/targets/hcloud_subnetwork/defaults/main.yml +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -hcloud_prefix: "tests" -hcloud_network_name: "{{hcloud_prefix}}-subnet" diff --git a/test/integration/targets/hcloud_subnetwork/tasks/main.yml b/test/integration/targets/hcloud_subnetwork/tasks/main.yml deleted file mode 100644 index f9734712fe..0000000000 --- a/test/integration/targets/hcloud_subnetwork/tasks/main.yml +++ /dev/null @@ -1,92 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -- name: setup - hcloud_network: - name: "{{ hcloud_network_name }}" - ip_range: "10.0.0.0/8" - state: present - register: network -- name: verify setup - assert: - that: - - network is success - -- name: test missing required parameters on create route - hcloud_subnetwork: - network: "{{ hcloud_network_name }}" - state: present - register: result - ignore_errors: yes -- name: verify fail test missing required parameters on create route - assert: - that: - - result is failed - - 'result.msg == "missing required arguments: network_zone, type, ip_range"' - -- name: test create subnetwork with checkmode - hcloud_subnetwork: - network: "{{ hcloud_network_name }}" - ip_range: "10.0.0.0/16" - type: "server" - network_zone: "eu-central" - state: present - register: result - check_mode: yes -- name: verify test create subnetwork with checkmode - assert: - that: - - result is changed - -- name: test create subnetwork - hcloud_subnetwork: - network: "{{ hcloud_network_name }}" - ip_range: "10.0.0.0/16" - type: "server" - network_zone: "eu-central" - state: present - register: subnet -- name: verify create subnetwork - assert: - that: - - subnet is changed - - subnet.hcloud_subnetwork.network == "{{ hcloud_network_name }}" - - subnet.hcloud_subnetwork.ip_range == "10.0.0.0/16" - - subnet.hcloud_subnetwork.type == "server" - - subnet.hcloud_subnetwork.network_zone == "eu-central" - -- name: test create subnetwork idempotency - hcloud_subnetwork: - network: "{{ hcloud_network_name }}" - ip_range: "10.0.0.0/16" - type: "server" - network_zone: "eu-central" - state: present - register: result -- name: verify create subnetwork idempotency - assert: - that: - - result is not changed - -- name: test absent subnetwork - hcloud_subnetwork: - network: "{{ hcloud_network_name }}" - ip_range: "10.0.0.0/16" - type: "server" - network_zone: "eu-central" - state: absent - register: result -- name: verify test absent subnetwork - assert: - that: - - result is changed - -- name: cleanup - hcloud_network: - name: "{{hcloud_network_name}}" - state: absent - register: result -- name: verify cleanup - assert: - that: - - result is success diff --git a/test/integration/targets/hcloud_volume/aliases b/test/integration/targets/hcloud_volume/aliases deleted file mode 100644 index 55ec821a47..0000000000 --- a/test/integration/targets/hcloud_volume/aliases +++ /dev/null @@ -1,2 +0,0 @@ -cloud/hcloud -shippable/hcloud/group2 diff --git a/test/integration/targets/hcloud_volume/defaults/main.yml b/test/integration/targets/hcloud_volume/defaults/main.yml deleted file mode 100644 index a8f03b4e57..0000000000 --- a/test/integration/targets/hcloud_volume/defaults/main.yml +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -hcloud_prefix: "tests" -hcloud_volume_name: "{{hcloud_prefix}}-integ" -hcloud_server_name: "{{hcloud_prefix}}-volume-server" diff --git a/test/integration/targets/hcloud_volume/tasks/main.yml b/test/integration/targets/hcloud_volume/tasks/main.yml deleted file mode 100644 index 78b9b4041e..0000000000 --- a/test/integration/targets/hcloud_volume/tasks/main.yml +++ /dev/null @@ -1,242 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -- name: setup server - hcloud_server: - name: "{{hcloud_server_name}}" - server_type: cx11 - image: ubuntu-18.04 - state: started - location: "fsn1" - register: vol_server -- name: verify setup server - assert: - that: - - vol_server is changed - -- name: test missing size parameter on create Volume - hcloud_volume: - name: "{{hcloud_volume_name}}" - server: "{{hcloud_server_name}}" - register: result - ignore_errors: yes -- name: verify fail test missing size parameter on create Volume - assert: - that: - - result is failed - - 'result.msg == "missing required arguments: size"' - -- name: test create Volume with check mode - hcloud_volume: - name: "{{hcloud_volume_name}}" - size: 10 - location: "fsn1" - register: result - check_mode: yes -- name: verify create Volume with check mode result - assert: - that: - - result is changed - -- name: test create Volume - hcloud_volume: - name: "{{hcloud_volume_name}}" - size: 10 - location: "fsn1" - register: volume -- name: verify test create Volume - assert: - that: - - volume is changed - - volume.hcloud_volume.name == "{{hcloud_volume_name}}" - - volume.hcloud_volume.location == "fsn1" - - volume.hcloud_volume.size == 10 - - volume.hcloud_volume.server != "{{hcloud_server_name}}" - - volume.hcloud_volume.linux_device is defined - -- name: test create Volume idempotence - hcloud_volume: - name: "{{hcloud_volume_name}}" - size: 10 - location: "fsn1" - register: volume -- name: verify test create Volume - assert: - that: - - volume is not changed - -- name: test attach Volume with checkmode - hcloud_volume: - name: "{{hcloud_volume_name}}" - server: "{{hcloud_server_name}}" - check_mode: yes - register: volume -- name: verify test attach Volume with checkmode - assert: - that: - - volume is changed - - volume.hcloud_volume.server != "{{hcloud_server_name}}" - -- name: test attach Volume - hcloud_volume: - name: "{{hcloud_volume_name}}" - server: "{{hcloud_server_name}}" - register: volume -- name: verify attach volume - assert: - that: - - volume is changed - - volume.hcloud_volume.server == "{{hcloud_server_name}}" - -- name: test attach Volume idempotence - hcloud_volume: - name: "{{hcloud_volume_name}}" - server: "{{hcloud_server_name}}" - register: volume -- name: verify attach Volume idempotence - assert: - that: - - volume is not changed - - volume.hcloud_volume.server == "{{hcloud_server_name}}" - -- name: test detach Volume with checkmode - hcloud_volume: - name: "{{hcloud_volume_name}}" - check_mode: yes - register: volume -- name: verify detach Volume with checkmode - assert: - that: - - volume is changed - - volume.hcloud_volume.server == "{{hcloud_server_name}}" - -- name: test detach Volume - hcloud_volume: - name: "{{hcloud_volume_name}}" - register: volume -- name: verify detach volume - assert: - that: - - volume is changed - - volume.hcloud_volume.location == "fsn1" - - volume.hcloud_volume.server != "{{hcloud_server_name}}" - -- name: test update Volume label - hcloud_volume: - name: "{{hcloud_volume_name}}" - labels: - key: value - register: volume -- name: verify test update Volume label - assert: - that: - - volume is changed - - volume.hcloud_volume.labels.key == "value" - -- name: test update Volume label with the same label - hcloud_volume: - name: "{{hcloud_volume_name}}" - labels: - key: value - register: volume -- name: verify test update Volume lable with the same label - assert: - that: - - volume is not changed - -- name: test increase Volume size - hcloud_volume: - name: "{{hcloud_volume_name}}" - size: 11 - register: volume -- name: verify test increase Volume size - assert: - that: - - volume is changed - - volume.hcloud_volume.size == 11 - -- name: test decreace Volume size - hcloud_volume: - name: "{{hcloud_volume_name}}" - size: 10 - register: volume -- name: verify test decreace Volume size - assert: - that: - - volume is not changed - - volume.hcloud_volume.size == 11 - -- name: test update Volume delete protection - hcloud_volume: - name: "{{hcloud_volume_name}}" - delete_protection: true - register: volume -- name: verify test update Volume delete protection - assert: - that: - - volume is changed - - volume.hcloud_volume.delete_protection is sameas true - -- name: test update Volume delete protection idempotency - hcloud_volume: - name: "{{hcloud_volume_name}}" - delete_protection: true - register: volume -- name: verify test update Volume delete protection idempotency - assert: - that: - - volume is not changed - - volume.hcloud_volume.delete_protection is sameas true - -- name: test Volume without delete protection set to be idempotent - hcloud_volume: - name: "{{hcloud_volume_name}}" - register: volume -- name: verify test Volume without delete protection set to be idempotent - assert: - that: - - volume is not changed - - volume.hcloud_volume.delete_protection is sameas true - -- name: test delete Volume fails if it is protected - hcloud_volume: - name: "{{hcloud_volume_name}}" - state: absent - ignore_errors: yes - register: result -- name: verify delete Volume fails if it is protected - assert: - that: - - result is failed - - 'result.msg == "volume deletion is protected"' - -- name: test update Volume delete protection - hcloud_volume: - name: "{{hcloud_volume_name}}" - delete_protection: false - register: volume -- name: verify test update Volume delete protection - assert: - that: - - volume is changed - - volume.hcloud_volume.delete_protection is sameas false - -- name: test delete Volume - hcloud_volume: - name: "{{hcloud_volume_name}}" - state: absent - register: result -- name: verify delete Volume - assert: - that: - - result is success - -- name: cleanup - hcloud_server: - name: "{{ hcloud_server_name }}" - state: absent - register: result -- name: verify cleanup - assert: - that: - - result is success diff --git a/test/integration/targets/hcloud_volume_info/aliases b/test/integration/targets/hcloud_volume_info/aliases deleted file mode 100644 index 55ec821a47..0000000000 --- a/test/integration/targets/hcloud_volume_info/aliases +++ /dev/null @@ -1,2 +0,0 @@ -cloud/hcloud -shippable/hcloud/group2 diff --git a/test/integration/targets/hcloud_volume_info/defaults/main.yml b/test/integration/targets/hcloud_volume_info/defaults/main.yml deleted file mode 100644 index d308c95090..0000000000 --- a/test/integration/targets/hcloud_volume_info/defaults/main.yml +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -hcloud_prefix: "tests" -hcloud_volume_name: "{{hcloud_prefix}}-facts" diff --git a/test/integration/targets/hcloud_volume_info/tasks/main.yml b/test/integration/targets/hcloud_volume_info/tasks/main.yml deleted file mode 100644 index ecea7ad317..0000000000 --- a/test/integration/targets/hcloud_volume_info/tasks/main.yml +++ /dev/null @@ -1,101 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -- name: setup ensure volume is absent - hcloud_volume: - name: "{{ hcloud_volume_name }}" - state: absent - register: result - -- name: setup volume - hcloud_volume: - name: "{{hcloud_volume_name}}" - size: 10 - location: "fsn1" - labels: - key: value - register: main_volume -- name: verify setup volume - assert: - that: - - main_volume is changed - -- name: test gather hcloud volume infos in check mode - hcloud_volume_info: - register: hcloud_volume - check_mode: yes - -- name: verify test gather hcloud volume infos in check mode - vars: - volume: "{{ hcloud_volume.hcloud_volume_info|selectattr('name','equalto',hcloud_volume_name) | first }}" - assert: - that: - - hcloud_volume.hcloud_volume_info|selectattr('name','equalto','{{ hcloud_volume_name }}') | list | count == 1 - - volume.name == "{{hcloud_volume_name}}" - - volume.location == "fsn1" - - volume.size == 10 - - volume.linux_device is defined - -- name: test gather hcloud volume infos with correct label selector - hcloud_volume_info: - label_selector: "key=value" - register: hcloud_volume -- name: verify test gather hcloud volume infos with correct label selector - assert: - that: - - hcloud_volume.hcloud_volume_info|selectattr('name','equalto','{{ hcloud_volume_name }}') | list | count == 1 - -- name: test gather hcloud volume infos with wrong label selector - hcloud_volume_info: - label_selector: "key!=value" - register: hcloud_volume -- name: verify test gather hcloud volume infos with wrong label selector - assert: - that: - - hcloud_volume.hcloud_volume_info | list | count == 0 - -- name: test gather hcloud volume infos with correct name - hcloud_volume_info: - name: "{{hcloud_volume_name}}" - register: hcloud_volume -- name: verify test gather hcloud volume infos with correct name - assert: - that: - - hcloud_volume.hcloud_volume_info|selectattr('name','equalto','{{ hcloud_volume_name }}') | list | count == 1 - -- name: test gather hcloud volume infos with wrong name - hcloud_volume_info: - name: "{{hcloud_volume_name}}1" - register: hcloud_volume -- name: verify test gather hcloud volume infos with wrong name - assert: - that: - - hcloud_volume.hcloud_volume_info | list | count == 0 - -- name: test gather hcloud volume facts with correct id - hcloud_volume_info: - id: "{{main_volume.hcloud_volume.id}}" - register: hcloud_volume -- name: verify test gather hcloud volume with correct id - assert: - that: - - hcloud_volume.hcloud_volume_info|selectattr('name','equalto','{{ hcloud_volume_name }}') | list | count == 1 - -- name: test gather hcloud volume infos with wrong id - hcloud_volume_info: - name: "4711" - register: hcloud_volume -- name: verify test gather hcloud volume infos with wrong id - assert: - that: - - hcloud_volume.hcloud_volume_info | list | count == 0 - -- name: cleanup - hcloud_volume: - name: "{{ hcloud_volume_name }}" - state: absent - register: result -- name: verify cleanup - assert: - that: - - result is success |