From f3d697c006f4f551162c7a51de68b2d1c62b1e69 Mon Sep 17 00:00:00 2001 From: Jonas L Date: Wed, 26 Jun 2024 16:10:58 +0200 Subject: [PATCH] test: use shared variable for server type, image and location (#522) ##### SUMMARY Use shared variables to store information about which server type, image or location to use for our integrations tests. - The location was changed from FSN to HEL. - The image was changed from ubuntu-22.04 to debian-12. --- .../common/defaults/main/common.yml | 15 ++++ .../certificate/defaults/main/common.yml | 15 ++++ .../certificate_info/defaults/main/common.yml | 15 ++++ .../datacenter_info/defaults/main/common.yml | 15 ++++ .../datacenter_info/defaults/main/main.yml | 6 -- .../targets/firewall/defaults/main/common.yml | 15 ++++ .../targets/firewall/tasks/prepare.yml | 4 +- .../firewall_info/defaults/main/common.yml | 15 ++++ .../targets/firewall_info/tasks/prepare.yml | 4 +- .../defaults/main/common.yml | 15 ++++ .../firewall_resource/tasks/prepare.yml | 4 +- .../floating_ip/defaults/main/common.yml | 15 ++++ .../targets/floating_ip/tasks/test.yml | 42 ++++++------ .../floating_ip_info/defaults/main/common.yml | 15 ++++ .../floating_ip_info/tasks/prepare.yml | 2 +- .../image_info/defaults/main/common.yml | 15 ++++ .../targets/image_info/defaults/main/main.yml | 1 - .../targets/image_info/tasks/prepare.yml | 4 +- .../targets/iso_info/defaults/main/common.yml | 15 ++++ .../load_balancer/defaults/main/common.yml | 15 ++++ .../defaults/main/common.yml | 15 ++++ .../load_balancer_info/tasks/prepare.yml | 4 +- .../defaults/main/common.yml | 15 ++++ .../load_balancer_network/tasks/test.yml | 2 +- .../defaults/main/common.yml | 15 ++++ .../load_balancer_service/tasks/test.yml | 2 +- .../defaults/main/common.yml | 15 ++++ .../load_balancer_target/tasks/test.yml | 8 +-- .../defaults/main/common.yml | 15 ++++ .../location_info/defaults/main/common.yml | 15 ++++ .../location_info/defaults/main/main.yml | 5 -- .../targets/network/defaults/main/common.yml | 15 ++++ .../network_info/defaults/main/common.yml | 15 ++++ .../placement_group/defaults/main/common.yml | 15 ++++ .../targets/placement_group/tasks/test.yml | 4 +- .../primary_ip/defaults/main/common.yml | 15 ++++ .../targets/primary_ip/tasks/prepare.yml | 4 +- .../targets/primary_ip/tasks/test.yml | 14 ++-- .../primary_ip_info/defaults/main/common.yml | 15 ++++ .../targets/primary_ip_info/tasks/prepare.yml | 2 +- .../targets/rdns/defaults/main/common.yml | 15 ++++ .../targets/rdns/tasks/prepare.yml | 8 +-- .../targets/route/defaults/main/common.yml | 15 ++++ .../targets/server/defaults/main/common.yml | 15 ++++ .../targets/server/tasks/test_basic.yml | 68 +++++++++---------- .../targets/server/tasks/test_firewalls.yml | 16 ++--- .../targets/server/tasks/test_primary_ips.yml | 18 ++--- .../tasks/test_private_network_only.yml | 18 ++--- .../targets/server/tasks/test_validation.yml | 4 +- .../server_info/defaults/main/common.yml | 15 ++++ .../targets/server_info/tasks/prepare.yml | 8 +-- .../server_network/defaults/main/common.yml | 15 ++++ .../targets/server_network/tasks/prepare.yml | 4 +- .../server_type_info/defaults/main/common.yml | 15 ++++ .../server_type_info/defaults/main/main.yml | 3 - .../targets/ssh_key/defaults/main/common.yml | 15 ++++ .../targets/ssh_key/tasks/test.yml | 4 +- .../ssh_key_info/defaults/main/common.yml | 15 ++++ .../subnetwork/defaults/main/common.yml | 15 ++++ .../targets/volume/defaults/main/common.yml | 15 ++++ .../integration/targets/volume/tasks/test.yml | 18 ++--- .../volume_info/defaults/main/common.yml | 15 ++++ .../targets/volume_info/tasks/prepare.yml | 2 +- .../targets/volume_info/tasks/test.yml | 2 +- 64 files changed, 645 insertions(+), 150 deletions(-) delete mode 100644 tests/integration/targets/datacenter_info/defaults/main/main.yml delete mode 100644 tests/integration/targets/location_info/defaults/main/main.yml diff --git a/tests/integration/common/defaults/main/common.yml b/tests/integration/common/defaults/main/common.yml index 2b6549e..89d1a81 100644 --- a/tests/integration/common/defaults/main/common.yml +++ b/tests/integration/common/defaults/main/common.yml @@ -7,3 +7,18 @@ hcloud_prefix: "tests" hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" + +# Used to easily update the server types and images across all our tests. +hcloud_server_type_name: cax11 +hcloud_server_type_id: 45 + +hcloud_server_type_upgrade_name: cax21 +hcloud_server_type_upgrade_id: 93 + +hcloud_image_name: debian-12 +hcloud_image_id: 114690389 # architecture=arm + +hcloud_location_name: hel1 +hcloud_location_id: 3 +hcloud_datacenter_name: hel1-dc2 +hcloud_datacenter_id: 3 diff --git a/tests/integration/targets/certificate/defaults/main/common.yml b/tests/integration/targets/certificate/defaults/main/common.yml index 159bb20..05fb77c 100644 --- a/tests/integration/targets/certificate/defaults/main/common.yml +++ b/tests/integration/targets/certificate/defaults/main/common.yml @@ -10,3 +10,18 @@ hcloud_prefix: "tests" hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" + +# Used to easily update the server types and images across all our tests. +hcloud_server_type_name: cax11 +hcloud_server_type_id: 45 + +hcloud_server_type_upgrade_name: cax21 +hcloud_server_type_upgrade_id: 93 + +hcloud_image_name: debian-12 +hcloud_image_id: 114690389 # architecture=arm + +hcloud_location_name: hel1 +hcloud_location_id: 3 +hcloud_datacenter_name: hel1-dc2 +hcloud_datacenter_id: 3 diff --git a/tests/integration/targets/certificate_info/defaults/main/common.yml b/tests/integration/targets/certificate_info/defaults/main/common.yml index 159bb20..05fb77c 100644 --- a/tests/integration/targets/certificate_info/defaults/main/common.yml +++ b/tests/integration/targets/certificate_info/defaults/main/common.yml @@ -10,3 +10,18 @@ hcloud_prefix: "tests" hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" + +# Used to easily update the server types and images across all our tests. +hcloud_server_type_name: cax11 +hcloud_server_type_id: 45 + +hcloud_server_type_upgrade_name: cax21 +hcloud_server_type_upgrade_id: 93 + +hcloud_image_name: debian-12 +hcloud_image_id: 114690389 # architecture=arm + +hcloud_location_name: hel1 +hcloud_location_id: 3 +hcloud_datacenter_name: hel1-dc2 +hcloud_datacenter_id: 3 diff --git a/tests/integration/targets/datacenter_info/defaults/main/common.yml b/tests/integration/targets/datacenter_info/defaults/main/common.yml index 159bb20..05fb77c 100644 --- a/tests/integration/targets/datacenter_info/defaults/main/common.yml +++ b/tests/integration/targets/datacenter_info/defaults/main/common.yml @@ -10,3 +10,18 @@ hcloud_prefix: "tests" hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" + +# Used to easily update the server types and images across all our tests. +hcloud_server_type_name: cax11 +hcloud_server_type_id: 45 + +hcloud_server_type_upgrade_name: cax21 +hcloud_server_type_upgrade_id: 93 + +hcloud_image_name: debian-12 +hcloud_image_id: 114690389 # architecture=arm + +hcloud_location_name: hel1 +hcloud_location_id: 3 +hcloud_datacenter_name: hel1-dc2 +hcloud_datacenter_id: 3 diff --git a/tests/integration/targets/datacenter_info/defaults/main/main.yml b/tests/integration/targets/datacenter_info/defaults/main/main.yml deleted file mode 100644 index 61490c9..0000000 --- a/tests/integration/targets/datacenter_info/defaults/main/main.yml +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -hcloud_datacenter_id: 4 -hcloud_datacenter_name: fsn1-dc14 -hcloud_location_name: fsn1 diff --git a/tests/integration/targets/firewall/defaults/main/common.yml b/tests/integration/targets/firewall/defaults/main/common.yml index 159bb20..05fb77c 100644 --- a/tests/integration/targets/firewall/defaults/main/common.yml +++ b/tests/integration/targets/firewall/defaults/main/common.yml @@ -10,3 +10,18 @@ hcloud_prefix: "tests" hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" + +# Used to easily update the server types and images across all our tests. +hcloud_server_type_name: cax11 +hcloud_server_type_id: 45 + +hcloud_server_type_upgrade_name: cax21 +hcloud_server_type_upgrade_id: 93 + +hcloud_image_name: debian-12 +hcloud_image_id: 114690389 # architecture=arm + +hcloud_location_name: hel1 +hcloud_location_id: 3 +hcloud_datacenter_name: hel1-dc2 +hcloud_datacenter_id: 3 diff --git a/tests/integration/targets/firewall/tasks/prepare.yml b/tests/integration/targets/firewall/tasks/prepare.yml index 540ca61..f959f7e 100644 --- a/tests/integration/targets/firewall/tasks/prepare.yml +++ b/tests/integration/targets/firewall/tasks/prepare.yml @@ -2,7 +2,7 @@ - name: Create test_server hetzner.hcloud.server: name: "{{ hcloud_server_name }}" - server_type: cax11 - image: ubuntu-22.04 + server_type: "{{ hcloud_server_type_name }}" + image: "{{ hcloud_image_name }}" state: stopped register: test_server diff --git a/tests/integration/targets/firewall_info/defaults/main/common.yml b/tests/integration/targets/firewall_info/defaults/main/common.yml index 159bb20..05fb77c 100644 --- a/tests/integration/targets/firewall_info/defaults/main/common.yml +++ b/tests/integration/targets/firewall_info/defaults/main/common.yml @@ -10,3 +10,18 @@ hcloud_prefix: "tests" hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" + +# Used to easily update the server types and images across all our tests. +hcloud_server_type_name: cax11 +hcloud_server_type_id: 45 + +hcloud_server_type_upgrade_name: cax21 +hcloud_server_type_upgrade_id: 93 + +hcloud_image_name: debian-12 +hcloud_image_id: 114690389 # architecture=arm + +hcloud_location_name: hel1 +hcloud_location_id: 3 +hcloud_datacenter_name: hel1-dc2 +hcloud_datacenter_id: 3 diff --git a/tests/integration/targets/firewall_info/tasks/prepare.yml b/tests/integration/targets/firewall_info/tasks/prepare.yml index c15512b..4337a73 100644 --- a/tests/integration/targets/firewall_info/tasks/prepare.yml +++ b/tests/integration/targets/firewall_info/tasks/prepare.yml @@ -2,8 +2,8 @@ - name: Create test_server hetzner.hcloud.server: name: "{{ hcloud_server_name }}" - server_type: cax11 - image: ubuntu-22.04 + server_type: "{{ hcloud_server_type_name }}" + image: "{{ hcloud_image_name }}" labels: firewall: "{{ hcloud_firewall_name }}" state: stopped diff --git a/tests/integration/targets/firewall_resource/defaults/main/common.yml b/tests/integration/targets/firewall_resource/defaults/main/common.yml index 159bb20..05fb77c 100644 --- a/tests/integration/targets/firewall_resource/defaults/main/common.yml +++ b/tests/integration/targets/firewall_resource/defaults/main/common.yml @@ -10,3 +10,18 @@ hcloud_prefix: "tests" hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" + +# Used to easily update the server types and images across all our tests. +hcloud_server_type_name: cax11 +hcloud_server_type_id: 45 + +hcloud_server_type_upgrade_name: cax21 +hcloud_server_type_upgrade_id: 93 + +hcloud_image_name: debian-12 +hcloud_image_id: 114690389 # architecture=arm + +hcloud_location_name: hel1 +hcloud_location_id: 3 +hcloud_datacenter_name: hel1-dc2 +hcloud_datacenter_id: 3 diff --git a/tests/integration/targets/firewall_resource/tasks/prepare.yml b/tests/integration/targets/firewall_resource/tasks/prepare.yml index 4a43bcd..3a9239a 100644 --- a/tests/integration/targets/firewall_resource/tasks/prepare.yml +++ b/tests/integration/targets/firewall_resource/tasks/prepare.yml @@ -2,8 +2,8 @@ - name: Create test_server hetzner.hcloud.server: name: "{{ hcloud_server_name }}" - server_type: cax11 - image: ubuntu-22.04 + server_type: "{{ hcloud_server_type_name }}" + image: "{{ hcloud_image_name }}" labels: key: value state: stopped diff --git a/tests/integration/targets/floating_ip/defaults/main/common.yml b/tests/integration/targets/floating_ip/defaults/main/common.yml index 159bb20..05fb77c 100644 --- a/tests/integration/targets/floating_ip/defaults/main/common.yml +++ b/tests/integration/targets/floating_ip/defaults/main/common.yml @@ -10,3 +10,18 @@ hcloud_prefix: "tests" hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" + +# Used to easily update the server types and images across all our tests. +hcloud_server_type_name: cax11 +hcloud_server_type_id: 45 + +hcloud_server_type_upgrade_name: cax21 +hcloud_server_type_upgrade_id: 93 + +hcloud_image_name: debian-12 +hcloud_image_id: 114690389 # architecture=arm + +hcloud_location_name: hel1 +hcloud_location_id: 3 +hcloud_datacenter_name: hel1-dc2 +hcloud_datacenter_id: 3 diff --git a/tests/integration/targets/floating_ip/tasks/test.yml b/tests/integration/targets/floating_ip/tasks/test.yml index 5d7e091..8f27e4f 100644 --- a/tests/integration/targets/floating_ip/tasks/test.yml +++ b/tests/integration/targets/floating_ip/tasks/test.yml @@ -19,10 +19,10 @@ - name: setup server hetzner.hcloud.server: name: "{{ hcloud_server_name }}" - server_type: cax11 - image: ubuntu-22.04 + server_type: "{{ hcloud_server_type_name }}" + image: "{{ hcloud_image_name }}" state: stopped - location: "fsn1" + location: "{{ hcloud_location_name }}" register: main_server - name: verify setup server assert: @@ -32,8 +32,8 @@ - name: setup another server hetzner.hcloud.server: name: "{{ hcloud_server_name }}2" - server_type: cax11 - image: ubuntu-22.04 + server_type: "{{ hcloud_server_type_name }}" + image: "{{ hcloud_image_name }}" state: stopped register: main_server2 - name: verify setup another server @@ -67,7 +67,7 @@ - name: test missing type parameter on delete Floating IP hetzner.hcloud.floating_ip: type: ipv4 - home_location: "fsn1" + home_location: "{{ hcloud_location_name }}" state: "absent" register: result ignore_errors: true @@ -81,7 +81,7 @@ hetzner.hcloud.floating_ip: name: "{{ hcloud_floating_ip_name }}" type: ipv5 - home_location: "fsn1" + home_location: "{{ hcloud_location_name }}" register: result ignore_errors: true - name: verify invalid type @@ -109,7 +109,7 @@ name: "{{ hcloud_floating_ip_name }}" description: "Web Server" type: ipv4 - home_location: "fsn1" + home_location: "{{ hcloud_location_name }}" register: floatingIP check_mode: true - name: verify test create Floating IP with check mode @@ -122,7 +122,7 @@ name: "{{ hcloud_floating_ip_name }}" description: "Web Server" type: ipv4 - home_location: "fsn1" + home_location: "{{ hcloud_location_name }}" register: floatingIP - name: verify test create Floating IP assert: @@ -130,14 +130,14 @@ - 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" + - floatingIP.hcloud_floating_ip.home_location == hcloud_location_name - name: test create Floating IP idempotency hetzner.hcloud.floating_ip: name: "{{ hcloud_floating_ip_name }}" description: "Web Server" type: ipv4 - home_location: "fsn1" + home_location: "{{ hcloud_location_name }}" register: floatingIP - name: verify test create Floating IP idempotency assert: @@ -149,7 +149,7 @@ name: "{{ hcloud_floating_ip_name }}" description: "changed-description" type: ipv4 - home_location: "fsn1" + home_location: "{{ hcloud_location_name }}" check_mode: true register: floatingIP - name: verify test create Floating IP with check mode @@ -163,7 +163,7 @@ name: "{{ hcloud_floating_ip_name }}" description: "changed-description" type: ipv4 - home_location: "fsn1" + home_location: "{{ hcloud_location_name }}" labels: key: value register: floatingIP @@ -178,7 +178,7 @@ name: "{{ hcloud_floating_ip_name }}" description: "changed-description" type: ipv4 - home_location: "fsn1" + home_location: "{{ hcloud_location_name }}" labels: key: value register: floatingIP @@ -191,7 +191,7 @@ hetzner.hcloud.floating_ip: name: "{{ hcloud_floating_ip_name }}" type: ipv4 - home_location: "fsn1" + home_location: "{{ hcloud_location_name }}" labels: key: value register: floatingIP @@ -204,7 +204,7 @@ hetzner.hcloud.floating_ip: name: "{{ hcloud_floating_ip_name }}" type: ipv4 - home_location: "fsn1" + home_location: "{{ hcloud_location_name }}" labels: key: value other: label @@ -218,7 +218,7 @@ hetzner.hcloud.floating_ip: name: "{{ hcloud_floating_ip_name }}" type: ipv4 - home_location: "fsn1" + home_location: "{{ hcloud_location_name }}" labels: other: label key: value @@ -271,7 +271,7 @@ hetzner.hcloud.floating_ip: name: "{{ hcloud_floating_ip_name }}" type: ipv4 - home_location: "fsn1" + home_location: "{{ hcloud_location_name }}" register: floatingIP - name: verify test unassign Floating IP assert: @@ -283,7 +283,7 @@ hetzner.hcloud.floating_ip: name: "{{ hcloud_floating_ip_name }}" type: ipv4 - home_location: "fsn1" + home_location: "{{ hcloud_location_name }}" register: floatingIP - name: verify test unassign Floating IPidempotency assert: @@ -401,7 +401,7 @@ hetzner.hcloud.floating_ip: name: "{{ hcloud_floating_ip_name }}" type: ipv6 - home_location: "fsn1" + home_location: "{{ hcloud_location_name }}" state: "present" register: result - name: verify test create ipv6 floating ip @@ -442,7 +442,7 @@ hetzner.hcloud.floating_ip: name: "{{ hcloud_floating_ip_name }}" type: ipv4 - home_location: fsn1 + home_location: "{{ hcloud_location_name }}" delete_protection: true register: floatingIP - name: verify create Floating IP with delete protection diff --git a/tests/integration/targets/floating_ip_info/defaults/main/common.yml b/tests/integration/targets/floating_ip_info/defaults/main/common.yml index 159bb20..05fb77c 100644 --- a/tests/integration/targets/floating_ip_info/defaults/main/common.yml +++ b/tests/integration/targets/floating_ip_info/defaults/main/common.yml @@ -10,3 +10,18 @@ hcloud_prefix: "tests" hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" + +# Used to easily update the server types and images across all our tests. +hcloud_server_type_name: cax11 +hcloud_server_type_id: 45 + +hcloud_server_type_upgrade_name: cax21 +hcloud_server_type_upgrade_id: 93 + +hcloud_image_name: debian-12 +hcloud_image_id: 114690389 # architecture=arm + +hcloud_location_name: hel1 +hcloud_location_id: 3 +hcloud_datacenter_name: hel1-dc2 +hcloud_datacenter_id: 3 diff --git a/tests/integration/targets/floating_ip_info/tasks/prepare.yml b/tests/integration/targets/floating_ip_info/tasks/prepare.yml index 26230ad..743982f 100644 --- a/tests/integration/targets/floating_ip_info/tasks/prepare.yml +++ b/tests/integration/targets/floating_ip_info/tasks/prepare.yml @@ -2,7 +2,7 @@ - name: Create test_floating_ip hetzner.hcloud.floating_ip: name: "{{ hcloud_floating_ip_name }}" - home_location: fsn1 + home_location: "{{ hcloud_location_name }}" type: ipv4 labels: key: value diff --git a/tests/integration/targets/image_info/defaults/main/common.yml b/tests/integration/targets/image_info/defaults/main/common.yml index 159bb20..05fb77c 100644 --- a/tests/integration/targets/image_info/defaults/main/common.yml +++ b/tests/integration/targets/image_info/defaults/main/common.yml @@ -10,3 +10,18 @@ hcloud_prefix: "tests" hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" + +# Used to easily update the server types and images across all our tests. +hcloud_server_type_name: cax11 +hcloud_server_type_id: 45 + +hcloud_server_type_upgrade_name: cax21 +hcloud_server_type_upgrade_id: 93 + +hcloud_image_name: debian-12 +hcloud_image_id: 114690389 # architecture=arm + +hcloud_location_name: hel1 +hcloud_location_id: 3 +hcloud_datacenter_name: hel1-dc2 +hcloud_datacenter_id: 3 diff --git a/tests/integration/targets/image_info/defaults/main/main.yml b/tests/integration/targets/image_info/defaults/main/main.yml index d7a3505..f96cd37 100644 --- a/tests/integration/targets/image_info/defaults/main/main.yml +++ b/tests/integration/targets/image_info/defaults/main/main.yml @@ -3,4 +3,3 @@ --- hcloud_server_name: "{{ hcloud_ns }}" hcloud_snapshot_name: "{{ hcloud_ns }}" -hcloud_image_name: ubuntu-22.04 diff --git a/tests/integration/targets/image_info/tasks/prepare.yml b/tests/integration/targets/image_info/tasks/prepare.yml index 3f441b8..4e72989 100644 --- a/tests/integration/targets/image_info/tasks/prepare.yml +++ b/tests/integration/targets/image_info/tasks/prepare.yml @@ -2,8 +2,8 @@ - name: Create test_server hetzner.hcloud.server: name: "{{ hcloud_server_name }}" - server_type: cax11 - image: ubuntu-22.04 + server_type: "{{ hcloud_server_type_name }}" + image: "{{ hcloud_image_name }}" state: stopped register: test_server diff --git a/tests/integration/targets/iso_info/defaults/main/common.yml b/tests/integration/targets/iso_info/defaults/main/common.yml index 159bb20..05fb77c 100644 --- a/tests/integration/targets/iso_info/defaults/main/common.yml +++ b/tests/integration/targets/iso_info/defaults/main/common.yml @@ -10,3 +10,18 @@ hcloud_prefix: "tests" hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" + +# Used to easily update the server types and images across all our tests. +hcloud_server_type_name: cax11 +hcloud_server_type_id: 45 + +hcloud_server_type_upgrade_name: cax21 +hcloud_server_type_upgrade_id: 93 + +hcloud_image_name: debian-12 +hcloud_image_id: 114690389 # architecture=arm + +hcloud_location_name: hel1 +hcloud_location_id: 3 +hcloud_datacenter_name: hel1-dc2 +hcloud_datacenter_id: 3 diff --git a/tests/integration/targets/load_balancer/defaults/main/common.yml b/tests/integration/targets/load_balancer/defaults/main/common.yml index 159bb20..05fb77c 100644 --- a/tests/integration/targets/load_balancer/defaults/main/common.yml +++ b/tests/integration/targets/load_balancer/defaults/main/common.yml @@ -10,3 +10,18 @@ hcloud_prefix: "tests" hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" + +# Used to easily update the server types and images across all our tests. +hcloud_server_type_name: cax11 +hcloud_server_type_id: 45 + +hcloud_server_type_upgrade_name: cax21 +hcloud_server_type_upgrade_id: 93 + +hcloud_image_name: debian-12 +hcloud_image_id: 114690389 # architecture=arm + +hcloud_location_name: hel1 +hcloud_location_id: 3 +hcloud_datacenter_name: hel1-dc2 +hcloud_datacenter_id: 3 diff --git a/tests/integration/targets/load_balancer_info/defaults/main/common.yml b/tests/integration/targets/load_balancer_info/defaults/main/common.yml index 159bb20..05fb77c 100644 --- a/tests/integration/targets/load_balancer_info/defaults/main/common.yml +++ b/tests/integration/targets/load_balancer_info/defaults/main/common.yml @@ -10,3 +10,18 @@ hcloud_prefix: "tests" hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" + +# Used to easily update the server types and images across all our tests. +hcloud_server_type_name: cax11 +hcloud_server_type_id: 45 + +hcloud_server_type_upgrade_name: cax21 +hcloud_server_type_upgrade_id: 93 + +hcloud_image_name: debian-12 +hcloud_image_id: 114690389 # architecture=arm + +hcloud_location_name: hel1 +hcloud_location_id: 3 +hcloud_datacenter_name: hel1-dc2 +hcloud_datacenter_id: 3 diff --git a/tests/integration/targets/load_balancer_info/tasks/prepare.yml b/tests/integration/targets/load_balancer_info/tasks/prepare.yml index c2d4d14..9af5c46 100644 --- a/tests/integration/targets/load_balancer_info/tasks/prepare.yml +++ b/tests/integration/targets/load_balancer_info/tasks/prepare.yml @@ -2,8 +2,8 @@ - name: Create test_server hetzner.hcloud.server: name: "{{ hcloud_server_name }}" - server_type: cax11 - image: ubuntu-22.04 + server_type: "{{ hcloud_server_type_name }}" + image: "{{ hcloud_image_name }}" state: stopped register: test_server diff --git a/tests/integration/targets/load_balancer_network/defaults/main/common.yml b/tests/integration/targets/load_balancer_network/defaults/main/common.yml index 159bb20..05fb77c 100644 --- a/tests/integration/targets/load_balancer_network/defaults/main/common.yml +++ b/tests/integration/targets/load_balancer_network/defaults/main/common.yml @@ -10,3 +10,18 @@ hcloud_prefix: "tests" hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" + +# Used to easily update the server types and images across all our tests. +hcloud_server_type_name: cax11 +hcloud_server_type_id: 45 + +hcloud_server_type_upgrade_name: cax21 +hcloud_server_type_upgrade_id: 93 + +hcloud_image_name: debian-12 +hcloud_image_id: 114690389 # architecture=arm + +hcloud_location_name: hel1 +hcloud_location_id: 3 +hcloud_datacenter_name: hel1-dc2 +hcloud_datacenter_id: 3 diff --git a/tests/integration/targets/load_balancer_network/tasks/test.yml b/tests/integration/targets/load_balancer_network/tasks/test.yml index 06e4696..d3a065e 100644 --- a/tests/integration/targets/load_balancer_network/tasks/test.yml +++ b/tests/integration/targets/load_balancer_network/tasks/test.yml @@ -30,7 +30,7 @@ name: "{{hcloud_load_balancer_name}}" load_balancer_type: lb11 state: present - location: "fsn1" + location: "{{ hcloud_location_name }}" register: load_balancer - name: verify setup load_balancer assert: diff --git a/tests/integration/targets/load_balancer_service/defaults/main/common.yml b/tests/integration/targets/load_balancer_service/defaults/main/common.yml index 159bb20..05fb77c 100644 --- a/tests/integration/targets/load_balancer_service/defaults/main/common.yml +++ b/tests/integration/targets/load_balancer_service/defaults/main/common.yml @@ -10,3 +10,18 @@ hcloud_prefix: "tests" hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" + +# Used to easily update the server types and images across all our tests. +hcloud_server_type_name: cax11 +hcloud_server_type_id: 45 + +hcloud_server_type_upgrade_name: cax21 +hcloud_server_type_upgrade_id: 93 + +hcloud_image_name: debian-12 +hcloud_image_id: 114690389 # architecture=arm + +hcloud_location_name: hel1 +hcloud_location_id: 3 +hcloud_datacenter_name: hel1-dc2 +hcloud_datacenter_id: 3 diff --git a/tests/integration/targets/load_balancer_service/tasks/test.yml b/tests/integration/targets/load_balancer_service/tasks/test.yml index 173709a..f82cf33 100644 --- a/tests/integration/targets/load_balancer_service/tasks/test.yml +++ b/tests/integration/targets/load_balancer_service/tasks/test.yml @@ -6,7 +6,7 @@ name: "{{hcloud_load_balancer_name}}" load_balancer_type: lb11 state: present - location: "fsn1" + location: "{{ hcloud_location_name }}" register: load_balancer - name: verify setup load_balancer assert: diff --git a/tests/integration/targets/load_balancer_target/defaults/main/common.yml b/tests/integration/targets/load_balancer_target/defaults/main/common.yml index 159bb20..05fb77c 100644 --- a/tests/integration/targets/load_balancer_target/defaults/main/common.yml +++ b/tests/integration/targets/load_balancer_target/defaults/main/common.yml @@ -10,3 +10,18 @@ hcloud_prefix: "tests" hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" + +# Used to easily update the server types and images across all our tests. +hcloud_server_type_name: cax11 +hcloud_server_type_id: 45 + +hcloud_server_type_upgrade_name: cax21 +hcloud_server_type_upgrade_id: 93 + +hcloud_image_name: debian-12 +hcloud_image_id: 114690389 # architecture=arm + +hcloud_location_name: hel1 +hcloud_location_id: 3 +hcloud_datacenter_name: hel1-dc2 +hcloud_datacenter_id: 3 diff --git a/tests/integration/targets/load_balancer_target/tasks/test.yml b/tests/integration/targets/load_balancer_target/tasks/test.yml index fd2bb1c..00ad191 100644 --- a/tests/integration/targets/load_balancer_target/tasks/test.yml +++ b/tests/integration/targets/load_balancer_target/tasks/test.yml @@ -4,10 +4,10 @@ - name: setup server hetzner.hcloud.server: name: "{{hcloud_server_name}}" - server_type: cax11 - image: ubuntu-22.04 + server_type: "{{ hcloud_server_type_name }}" + image: "{{ hcloud_image_name }}" state: stopped - location: "fsn1" + location: "{{ hcloud_location_name }}" register: server - name: verify setup server assert: @@ -19,7 +19,7 @@ name: "{{hcloud_load_balancer_name}}" load_balancer_type: lb11 state: present - location: "fsn1" + location: "{{ hcloud_location_name }}" register: load_balancer - name: verify setup load_balancer assert: diff --git a/tests/integration/targets/load_balancer_type_info/defaults/main/common.yml b/tests/integration/targets/load_balancer_type_info/defaults/main/common.yml index 159bb20..05fb77c 100644 --- a/tests/integration/targets/load_balancer_type_info/defaults/main/common.yml +++ b/tests/integration/targets/load_balancer_type_info/defaults/main/common.yml @@ -10,3 +10,18 @@ hcloud_prefix: "tests" hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" + +# Used to easily update the server types and images across all our tests. +hcloud_server_type_name: cax11 +hcloud_server_type_id: 45 + +hcloud_server_type_upgrade_name: cax21 +hcloud_server_type_upgrade_id: 93 + +hcloud_image_name: debian-12 +hcloud_image_id: 114690389 # architecture=arm + +hcloud_location_name: hel1 +hcloud_location_id: 3 +hcloud_datacenter_name: hel1-dc2 +hcloud_datacenter_id: 3 diff --git a/tests/integration/targets/location_info/defaults/main/common.yml b/tests/integration/targets/location_info/defaults/main/common.yml index 159bb20..05fb77c 100644 --- a/tests/integration/targets/location_info/defaults/main/common.yml +++ b/tests/integration/targets/location_info/defaults/main/common.yml @@ -10,3 +10,18 @@ hcloud_prefix: "tests" hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" + +# Used to easily update the server types and images across all our tests. +hcloud_server_type_name: cax11 +hcloud_server_type_id: 45 + +hcloud_server_type_upgrade_name: cax21 +hcloud_server_type_upgrade_id: 93 + +hcloud_image_name: debian-12 +hcloud_image_id: 114690389 # architecture=arm + +hcloud_location_name: hel1 +hcloud_location_id: 3 +hcloud_datacenter_name: hel1-dc2 +hcloud_datacenter_id: 3 diff --git a/tests/integration/targets/location_info/defaults/main/main.yml b/tests/integration/targets/location_info/defaults/main/main.yml deleted file mode 100644 index 72f0db5..0000000 --- a/tests/integration/targets/location_info/defaults/main/main.yml +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright: (c) 2019, Hetzner Cloud GmbH -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -hcloud_location_id: 1 -hcloud_location_name: fsn1 diff --git a/tests/integration/targets/network/defaults/main/common.yml b/tests/integration/targets/network/defaults/main/common.yml index 159bb20..05fb77c 100644 --- a/tests/integration/targets/network/defaults/main/common.yml +++ b/tests/integration/targets/network/defaults/main/common.yml @@ -10,3 +10,18 @@ hcloud_prefix: "tests" hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" + +# Used to easily update the server types and images across all our tests. +hcloud_server_type_name: cax11 +hcloud_server_type_id: 45 + +hcloud_server_type_upgrade_name: cax21 +hcloud_server_type_upgrade_id: 93 + +hcloud_image_name: debian-12 +hcloud_image_id: 114690389 # architecture=arm + +hcloud_location_name: hel1 +hcloud_location_id: 3 +hcloud_datacenter_name: hel1-dc2 +hcloud_datacenter_id: 3 diff --git a/tests/integration/targets/network_info/defaults/main/common.yml b/tests/integration/targets/network_info/defaults/main/common.yml index 159bb20..05fb77c 100644 --- a/tests/integration/targets/network_info/defaults/main/common.yml +++ b/tests/integration/targets/network_info/defaults/main/common.yml @@ -10,3 +10,18 @@ hcloud_prefix: "tests" hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" + +# Used to easily update the server types and images across all our tests. +hcloud_server_type_name: cax11 +hcloud_server_type_id: 45 + +hcloud_server_type_upgrade_name: cax21 +hcloud_server_type_upgrade_id: 93 + +hcloud_image_name: debian-12 +hcloud_image_id: 114690389 # architecture=arm + +hcloud_location_name: hel1 +hcloud_location_id: 3 +hcloud_datacenter_name: hel1-dc2 +hcloud_datacenter_id: 3 diff --git a/tests/integration/targets/placement_group/defaults/main/common.yml b/tests/integration/targets/placement_group/defaults/main/common.yml index 159bb20..05fb77c 100644 --- a/tests/integration/targets/placement_group/defaults/main/common.yml +++ b/tests/integration/targets/placement_group/defaults/main/common.yml @@ -10,3 +10,18 @@ hcloud_prefix: "tests" hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" + +# Used to easily update the server types and images across all our tests. +hcloud_server_type_name: cax11 +hcloud_server_type_id: 45 + +hcloud_server_type_upgrade_name: cax21 +hcloud_server_type_upgrade_id: 93 + +hcloud_image_name: debian-12 +hcloud_image_id: 114690389 # architecture=arm + +hcloud_location_name: hel1 +hcloud_location_id: 3 +hcloud_datacenter_name: hel1-dc2 +hcloud_datacenter_id: 3 diff --git a/tests/integration/targets/placement_group/tasks/test.yml b/tests/integration/targets/placement_group/tasks/test.yml index 4008f2e..92ad5bf 100644 --- a/tests/integration/targets/placement_group/tasks/test.yml +++ b/tests/integration/targets/placement_group/tasks/test.yml @@ -64,9 +64,9 @@ - name: test create server with placement group hetzner.hcloud.server: name: "{{ hcloud_server_name }}" - server_type: cax11 + server_type: "{{ hcloud_server_type_name }}" placement_group: "{{ hcloud_placement_group_name }}" - image: "ubuntu-22.04" + image: "{{ hcloud_image_name }}" ssh_keys: - "{{ hcloud_ssh_key_name }}" state: present diff --git a/tests/integration/targets/primary_ip/defaults/main/common.yml b/tests/integration/targets/primary_ip/defaults/main/common.yml index 159bb20..05fb77c 100644 --- a/tests/integration/targets/primary_ip/defaults/main/common.yml +++ b/tests/integration/targets/primary_ip/defaults/main/common.yml @@ -10,3 +10,18 @@ hcloud_prefix: "tests" hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" + +# Used to easily update the server types and images across all our tests. +hcloud_server_type_name: cax11 +hcloud_server_type_id: 45 + +hcloud_server_type_upgrade_name: cax21 +hcloud_server_type_upgrade_id: 93 + +hcloud_image_name: debian-12 +hcloud_image_id: 114690389 # architecture=arm + +hcloud_location_name: hel1 +hcloud_location_id: 3 +hcloud_datacenter_name: hel1-dc2 +hcloud_datacenter_id: 3 diff --git a/tests/integration/targets/primary_ip/tasks/prepare.yml b/tests/integration/targets/primary_ip/tasks/prepare.yml index acd8af6..36ddfc1 100644 --- a/tests/integration/targets/primary_ip/tasks/prepare.yml +++ b/tests/integration/targets/primary_ip/tasks/prepare.yml @@ -2,8 +2,8 @@ - name: Create test_server hetzner.hcloud.server: name: "{{ hcloud_server_name }}" - server_type: cax11 - image: ubuntu-22.04 + server_type: "{{ hcloud_server_type_name }}" + image: "{{ hcloud_image_name }}" state: stopped enable_ipv4: false enable_ipv6: false diff --git a/tests/integration/targets/primary_ip/tasks/test.yml b/tests/integration/targets/primary_ip/tasks/test.yml index 63c4106..1c43846 100644 --- a/tests/integration/targets/primary_ip/tasks/test.yml +++ b/tests/integration/targets/primary_ip/tasks/test.yml @@ -16,7 +16,7 @@ hetzner.hcloud.primary_ip: name: "{{ hcloud_primary_ip_name }}" type: ipv6 - datacenter: fsn1-dc14 + datacenter: "{{ hcloud_datacenter_name }}" labels: key: value check_mode: true @@ -30,7 +30,7 @@ hetzner.hcloud.primary_ip: name: "{{ hcloud_primary_ip_name }}" type: ipv6 - datacenter: fsn1-dc14 + datacenter: "{{ hcloud_datacenter_name }}" labels: key: value register: result @@ -40,7 +40,7 @@ - result is changed - result.hcloud_primary_ip.name == hcloud_primary_ip_name - result.hcloud_primary_ip.type == "ipv6" - - result.hcloud_primary_ip.datacenter == "fsn1-dc14" + - result.hcloud_primary_ip.datacenter == hcloud_datacenter_name - result.hcloud_primary_ip.assignee_type == "server" - result.hcloud_primary_ip.assignee_id is none - result.hcloud_primary_ip.labels.key == "value" @@ -51,7 +51,7 @@ hetzner.hcloud.primary_ip: name: "{{ hcloud_primary_ip_name }}" type: ipv6 - datacenter: fsn1-dc14 + datacenter: "{{ hcloud_datacenter_name }}" labels: key: value register: result @@ -64,7 +64,7 @@ hetzner.hcloud.primary_ip: name: "{{ hcloud_primary_ip_name }}" type: ipv6 - datacenter: fsn1-dc14 + datacenter: "{{ hcloud_datacenter_name }}" labels: key: value foo: bar @@ -76,7 +76,7 @@ - result is changed - result.hcloud_primary_ip.name == hcloud_primary_ip_name - result.hcloud_primary_ip.type == "ipv6" - - result.hcloud_primary_ip.datacenter == "fsn1-dc14" + - result.hcloud_primary_ip.datacenter == hcloud_datacenter_name - result.hcloud_primary_ip.assignee_type == "server" - result.hcloud_primary_ip.assignee_id is none - result.hcloud_primary_ip.labels.key == "value" @@ -88,7 +88,7 @@ hetzner.hcloud.primary_ip: name: "{{ hcloud_primary_ip_name }}" type: ipv6 - datacenter: fsn1-dc14 + datacenter: "{{ hcloud_datacenter_name }}" labels: key: value foo: bar diff --git a/tests/integration/targets/primary_ip_info/defaults/main/common.yml b/tests/integration/targets/primary_ip_info/defaults/main/common.yml index 159bb20..05fb77c 100644 --- a/tests/integration/targets/primary_ip_info/defaults/main/common.yml +++ b/tests/integration/targets/primary_ip_info/defaults/main/common.yml @@ -10,3 +10,18 @@ hcloud_prefix: "tests" hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" + +# Used to easily update the server types and images across all our tests. +hcloud_server_type_name: cax11 +hcloud_server_type_id: 45 + +hcloud_server_type_upgrade_name: cax21 +hcloud_server_type_upgrade_id: 93 + +hcloud_image_name: debian-12 +hcloud_image_id: 114690389 # architecture=arm + +hcloud_location_name: hel1 +hcloud_location_id: 3 +hcloud_datacenter_name: hel1-dc2 +hcloud_datacenter_id: 3 diff --git a/tests/integration/targets/primary_ip_info/tasks/prepare.yml b/tests/integration/targets/primary_ip_info/tasks/prepare.yml index 4c96ee8..1c67892 100644 --- a/tests/integration/targets/primary_ip_info/tasks/prepare.yml +++ b/tests/integration/targets/primary_ip_info/tasks/prepare.yml @@ -2,7 +2,7 @@ - name: Create test_primary_ip hetzner.hcloud.primary_ip: name: "{{ hcloud_primary_ip_name }}" - datacenter: fsn1-dc14 + datacenter: "{{ hcloud_datacenter_name }}" type: ipv4 labels: key: value diff --git a/tests/integration/targets/rdns/defaults/main/common.yml b/tests/integration/targets/rdns/defaults/main/common.yml index 159bb20..05fb77c 100644 --- a/tests/integration/targets/rdns/defaults/main/common.yml +++ b/tests/integration/targets/rdns/defaults/main/common.yml @@ -10,3 +10,18 @@ hcloud_prefix: "tests" hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" + +# Used to easily update the server types and images across all our tests. +hcloud_server_type_name: cax11 +hcloud_server_type_id: 45 + +hcloud_server_type_upgrade_name: cax21 +hcloud_server_type_upgrade_id: 93 + +hcloud_image_name: debian-12 +hcloud_image_id: 114690389 # architecture=arm + +hcloud_location_name: hel1 +hcloud_location_id: 3 +hcloud_datacenter_name: hel1-dc2 +hcloud_datacenter_id: 3 diff --git a/tests/integration/targets/rdns/tasks/prepare.yml b/tests/integration/targets/rdns/tasks/prepare.yml index 83fabdd..8d4b703 100644 --- a/tests/integration/targets/rdns/tasks/prepare.yml +++ b/tests/integration/targets/rdns/tasks/prepare.yml @@ -2,8 +2,8 @@ - name: Create test_server hetzner.hcloud.server: name: "{{ hcloud_server_name }}" - server_type: cax11 - image: ubuntu-22.04 + server_type: "{{ hcloud_server_type_name }}" + image: "{{ hcloud_image_name }}" state: present register: test_server @@ -11,7 +11,7 @@ hetzner.hcloud.primary_ip: name: "{{ hcloud_primary_ip_name }}" type: ipv4 - datacenter: fsn1-dc14 + datacenter: "{{ hcloud_datacenter_name }}" state: present register: test_primary_ip @@ -19,7 +19,7 @@ hetzner.hcloud.floating_ip: name: "{{ hcloud_floating_ip_name }}" type: ipv4 - home_location: fsn1 + home_location: "{{ hcloud_location_name }}" state: present register: test_floating_ip diff --git a/tests/integration/targets/route/defaults/main/common.yml b/tests/integration/targets/route/defaults/main/common.yml index 159bb20..05fb77c 100644 --- a/tests/integration/targets/route/defaults/main/common.yml +++ b/tests/integration/targets/route/defaults/main/common.yml @@ -10,3 +10,18 @@ hcloud_prefix: "tests" hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" + +# Used to easily update the server types and images across all our tests. +hcloud_server_type_name: cax11 +hcloud_server_type_id: 45 + +hcloud_server_type_upgrade_name: cax21 +hcloud_server_type_upgrade_id: 93 + +hcloud_image_name: debian-12 +hcloud_image_id: 114690389 # architecture=arm + +hcloud_location_name: hel1 +hcloud_location_id: 3 +hcloud_datacenter_name: hel1-dc2 +hcloud_datacenter_id: 3 diff --git a/tests/integration/targets/server/defaults/main/common.yml b/tests/integration/targets/server/defaults/main/common.yml index 159bb20..05fb77c 100644 --- a/tests/integration/targets/server/defaults/main/common.yml +++ b/tests/integration/targets/server/defaults/main/common.yml @@ -10,3 +10,18 @@ hcloud_prefix: "tests" hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" + +# Used to easily update the server types and images across all our tests. +hcloud_server_type_name: cax11 +hcloud_server_type_id: 45 + +hcloud_server_type_upgrade_name: cax21 +hcloud_server_type_upgrade_id: 93 + +hcloud_image_name: debian-12 +hcloud_image_id: 114690389 # architecture=arm + +hcloud_location_name: hel1 +hcloud_location_id: 3 +hcloud_datacenter_name: hel1-dc2 +hcloud_datacenter_id: 3 diff --git a/tests/integration/targets/server/tasks/test_basic.yml b/tests/integration/targets/server/tasks/test_basic.yml index e2657da..b80a0d2 100644 --- a/tests/integration/targets/server/tasks/test_basic.yml +++ b/tests/integration/targets/server/tasks/test_basic.yml @@ -1,8 +1,8 @@ - name: test create server with check mode hetzner.hcloud.server: name: "{{ hcloud_server_name }}" - server_type: cax11 - image: ubuntu-22.04 + server_type: "{{ hcloud_server_type_name }}" + image: "{{ hcloud_image_name }}" state: present register: result check_mode: true @@ -14,8 +14,8 @@ - name: test create server hetzner.hcloud.server: name: "{{ hcloud_server_name}}" - server_type: cax11 - image: ubuntu-22.04 + server_type: "{{ hcloud_server_type_name }}" + image: "{{ hcloud_image_name }}" enable_ipv6: False state: started register: main_server @@ -24,7 +24,7 @@ that: - main_server is changed - main_server.hcloud_server.name == hcloud_server_name - - main_server.hcloud_server.server_type == "cax11" + - main_server.hcloud_server.server_type == hcloud_server_type_name - main_server.hcloud_server.status == "running" - main_server.root_password != "" @@ -108,7 +108,7 @@ - name: test resize server running without force hetzner.hcloud.server: name: "{{ hcloud_server_name }}" - server_type: "cax21" + server_type: "{{ hcloud_server_type_upgrade_name }}" state: present register: result check_mode: true @@ -116,12 +116,12 @@ assert: that: - result is changed - - result.hcloud_server.server_type == "cax11" + - result.hcloud_server.server_type == hcloud_server_type_name - name: test resize server with check mode hetzner.hcloud.server: name: "{{ hcloud_server_name }}" - server_type: "cax21" + server_type: "{{ hcloud_server_type_upgrade_name }}" state: stopped register: result check_mode: true @@ -133,19 +133,19 @@ - name: test resize server without disk hetzner.hcloud.server: name: "{{ hcloud_server_name }}" - server_type: "cax21" + server_type: "{{ hcloud_server_type_upgrade_name }}" state: stopped register: result - name: verify resize server without disk assert: that: - result is changed - - result.hcloud_server.server_type == "cax21" + - result.hcloud_server.server_type == hcloud_server_type_upgrade_name - name: test resize server idempotence hetzner.hcloud.server: name: "{{ hcloud_server_name }}" - server_type: "cax21" + server_type: "{{ hcloud_server_type_upgrade_name }}" state: stopped register: result - name: verify resize server idempotence @@ -156,19 +156,19 @@ - name: test resize server to smaller plan hetzner.hcloud.server: name: "{{ hcloud_server_name }}" - server_type: "cax11" + server_type: "{{ hcloud_server_type_name }}" state: stopped register: result - name: verify resize server to smaller plan assert: that: - result is changed - - result.hcloud_server.server_type == "cax11" + - result.hcloud_server.server_type == hcloud_server_type_name - name: test resize server with disk hetzner.hcloud.server: name: "{{ hcloud_server_name }}" - server_type: "cax21" + server_type: "{{ hcloud_server_type_upgrade_name }}" upgrade_disk: true state: stopped register: result @@ -176,7 +176,7 @@ assert: that: - result is changed - - result.hcloud_server.server_type == "cax21" + - result.hcloud_server.server_type == hcloud_server_type_upgrade_name - name: test enable backups with check mode hetzner.hcloud.server: @@ -232,7 +232,7 @@ - name: test rebuild server hetzner.hcloud.server: name: "{{ hcloud_server_name }}" - image: ubuntu-22.04 + image: "{{ hcloud_image_name }}" state: rebuild register: result_after_test - name: verify rebuild server @@ -244,7 +244,7 @@ - name: test rebuild server with check mode hetzner.hcloud.server: name: "{{ hcloud_server_name }}" - image: ubuntu-22.04 + image: "{{ hcloud_image_name }}" state: rebuild register: result_after_test check_mode: true @@ -321,7 +321,7 @@ - name: test rebuild server fails if it is protected hetzner.hcloud.server: name: "{{hcloud_server_name}}" - image: ubuntu-22.04 + image: "{{ hcloud_image_name }}" state: rebuild ignore_errors: true register: result @@ -360,8 +360,8 @@ - name: test create server with ssh key hetzner.hcloud.server: name: "{{ hcloud_server_name}}" - server_type: cax11 - image: "ubuntu-22.04" + server_type: "{{ hcloud_server_type_name }}" + image: "{{ hcloud_image_name }}" ssh_keys: - "{{ hcloud_ssh_key_name }}" state: started @@ -371,7 +371,7 @@ that: - main_server is changed - main_server.hcloud_server.name == hcloud_server_name - - main_server.hcloud_server.server_type == "cax11" + - main_server.hcloud_server.server_type == hcloud_server_type_name - main_server.hcloud_server.status == "running" - main_server.root_password != "" @@ -441,8 +441,8 @@ - name: test create server with rescue_mode hetzner.hcloud.server: name: "{{ hcloud_server_name}}" - server_type: cax11 - image: "ubuntu-22.04" + server_type: "{{ hcloud_server_type_name }}" + image: "{{ hcloud_image_name }}" ssh_keys: - "{{ hcloud_ssh_key_name }}" rescue_mode: "linux64" @@ -453,7 +453,7 @@ that: - main_server is changed - main_server.hcloud_server.name == hcloud_server_name - - main_server.hcloud_server.server_type == "cax11" + - main_server.hcloud_server.server_type == hcloud_server_type_name - main_server.hcloud_server.status == "running" - main_server.root_password != "" - main_server.hcloud_server.rescue_enabled is sameas true @@ -470,8 +470,8 @@ - name: test create server with labels hetzner.hcloud.server: name: "{{ hcloud_server_name}}" - server_type: cax11 - image: "ubuntu-22.04" + server_type: "{{ hcloud_server_type_name }}" + image: "{{ hcloud_image_name }}" ssh_keys: - "{{ hcloud_ssh_key_name }}" labels: @@ -489,8 +489,8 @@ - name: test update server with labels hetzner.hcloud.server: name: "{{ hcloud_server_name}}" - server_type: cax11 - image: "ubuntu-22.04" + server_type: "{{ hcloud_server_type_name }}" + image: "{{ hcloud_image_name }}" ssh_keys: - "{{ hcloud_ssh_key_name }}" labels: @@ -508,8 +508,8 @@ - name: test update server with labels in other order hetzner.hcloud.server: name: "{{ hcloud_server_name}}" - server_type: cax11 - image: "ubuntu-22.04" + server_type: "{{ hcloud_server_type_name }}" + image: "{{ hcloud_image_name }}" ssh_keys: - "{{ hcloud_ssh_key_name }}" labels: @@ -535,9 +535,9 @@ - name: test create server with enabled backups hetzner.hcloud.server: name: "{{ hcloud_server_name }}" - server_type: cax11 + server_type: "{{ hcloud_server_type_name }}" backups: true - image: "ubuntu-22.04" + image: "{{ hcloud_image_name }}" ssh_keys: - "{{ hcloud_ssh_key_name }}" state: present @@ -563,8 +563,8 @@ name: "{{ hcloud_server_name }}" delete_protection: true rebuild_protection: true - server_type: cax11 - image: "ubuntu-22.04" + server_type: "{{ hcloud_server_type_name }}" + image: "{{ hcloud_image_name }}" ssh_keys: - "{{ hcloud_ssh_key_name }}" state: present diff --git a/tests/integration/targets/server/tasks/test_firewalls.yml b/tests/integration/targets/server/tasks/test_firewalls.yml index e824d16..661012c 100644 --- a/tests/integration/targets/server/tasks/test_firewalls.yml +++ b/tests/integration/targets/server/tasks/test_firewalls.yml @@ -32,10 +32,10 @@ - name: test create server with firewalls hetzner.hcloud.server: name: "{{ hcloud_server_name }}" - server_type: cax11 + server_type: "{{ hcloud_server_type_name }}" firewalls: - "{{ hcloud_firewall_name }}" - image: "ubuntu-22.04" + image: "{{ hcloud_image_name }}" ssh_keys: - "{{ hcloud_ssh_key_name }}" state: present @@ -48,10 +48,10 @@ - name: test create server with firewalls idempotence hetzner.hcloud.server: name: "{{ hcloud_server_name }}" - server_type: cax11 + server_type: "{{ hcloud_server_type_name }}" firewalls: - "{{ hcloud_firewall_name }}" - image: "ubuntu-22.04" + image: "{{ hcloud_image_name }}" ssh_keys: - "{{ hcloud_ssh_key_name }}" state: present @@ -64,10 +64,10 @@ - name: test update server with firewalls hetzner.hcloud.server: name: "{{ hcloud_server_name }}" - server_type: cax11 + server_type: "{{ hcloud_server_type_name }}" firewalls: - "{{ hcloud_firewall_name }}2" - image: "ubuntu-22.04" + image: "{{ hcloud_image_name }}" ssh_keys: - "{{ hcloud_ssh_key_name }}" state: present @@ -80,10 +80,10 @@ - name: test update server with firewalls idempotence hetzner.hcloud.server: name: "{{ hcloud_server_name }}" - server_type: cax11 + server_type: "{{ hcloud_server_type_name }}" firewalls: - "{{ hcloud_firewall_name }}2" - image: "ubuntu-22.04" + image: "{{ hcloud_image_name }}" ssh_keys: - "{{ hcloud_ssh_key_name }}" state: present diff --git a/tests/integration/targets/server/tasks/test_primary_ips.yml b/tests/integration/targets/server/tasks/test_primary_ips.yml index 352f0ce..9e74e52 100644 --- a/tests/integration/targets/server/tasks/test_primary_ips.yml +++ b/tests/integration/targets/server/tasks/test_primary_ips.yml @@ -5,29 +5,29 @@ hetzner.hcloud.primary_ip: name: "{{ hcloud_primary_ip_name }}v4" type: ipv4 - datacenter: "fsn1-dc14" + datacenter: "{{ hcloud_datacenter_name }}" register: primaryIPv4 - name: setup create second primary ipv4 hetzner.hcloud.primary_ip: name: "{{ hcloud_primary_ip_name }}v42" type: ipv4 - datacenter: "fsn1-dc14" + datacenter: "{{ hcloud_datacenter_name }}" register: secondPrimaryIPv4 - name: setup create primary ipv6 hetzner.hcloud.primary_ip: name: "{{ hcloud_primary_ip_name }}v6" type: ipv6 - datacenter: "fsn1-dc14" + datacenter: "{{ hcloud_datacenter_name }}" register: primaryIPv6 - name: test create server with primary ips hetzner.hcloud.server: name: "{{ hcloud_server_name }}" - server_type: cax11 - datacenter: "fsn1-dc14" - image: "ubuntu-22.04" + server_type: "{{ hcloud_server_type_name }}" + datacenter: "{{ hcloud_datacenter_name }}" + image: "{{ hcloud_image_name }}" ipv4: "{{primaryIPv4.hcloud_primary_ip.id}}" ipv6: "{{primaryIPv6.hcloud_primary_ip.id}}" ssh_keys: @@ -42,9 +42,9 @@ - name: test update server with primary ips hetzner.hcloud.server: name: "{{ hcloud_server_name }}" - server_type: cax11 - datacenter: "fsn1-dc14" - image: "ubuntu-22.04" + server_type: "{{ hcloud_server_type_name }}" + datacenter: "{{ hcloud_datacenter_name }}" + image: "{{ hcloud_image_name }}" ipv4: "{{secondPrimaryIPv4.hcloud_primary_ip.id}}" ipv6: "" enable_ipv6: false diff --git a/tests/integration/targets/server/tasks/test_private_network_only.yml b/tests/integration/targets/server/tasks/test_private_network_only.yml index 52ad0ef..2ae682e 100644 --- a/tests/integration/targets/server/tasks/test_private_network_only.yml +++ b/tests/integration/targets/server/tasks/test_private_network_only.yml @@ -63,9 +63,9 @@ - name: test create server with primary network and no internet hetzner.hcloud.server: name: "{{ hcloud_server_name }}" - server_type: cax11 - datacenter: "fsn1-dc14" - image: "ubuntu-22.04" + server_type: "{{ hcloud_server_type_name }}" + datacenter: "{{ hcloud_datacenter_name }}" + image: "{{ hcloud_image_name }}" enable_ipv4: false enable_ipv6: false private_networks: @@ -82,9 +82,9 @@ - name: test update server by adding secondary network hetzner.hcloud.server: name: "{{ hcloud_server_name }}" - server_type: cax11 - datacenter: "fsn1-dc14" - image: "ubuntu-22.04" + server_type: "{{ hcloud_server_type_name }}" + datacenter: "{{ hcloud_datacenter_name }}" + image: "{{ hcloud_image_name }}" enable_ipv4: false enable_ipv6: false private_networks: @@ -102,9 +102,9 @@ - name: test update server idem hetzner.hcloud.server: name: "{{ hcloud_server_name }}" - server_type: cax11 - datacenter: "fsn1-dc14" - image: "ubuntu-22.04" + server_type: "{{ hcloud_server_type_name }}" + datacenter: "{{ hcloud_datacenter_name }}" + image: "{{ hcloud_image_name }}" enable_ipv4: false enable_ipv6: false private_networks: diff --git a/tests/integration/targets/server/tasks/test_validation.yml b/tests/integration/targets/server/tasks/test_validation.yml index 6326548..545117b 100644 --- a/tests/integration/targets/server/tasks/test_validation.yml +++ b/tests/integration/targets/server/tasks/test_validation.yml @@ -26,7 +26,7 @@ hetzner.hcloud.server: name: "{{ hcloud_server_name }}" server_type: not-existing-server-type - image: ubuntu-22.04 + image: "{{ hcloud_image_name }}" state: present register: result ignore_errors: true @@ -40,7 +40,7 @@ - name: test create server with not existing image hetzner.hcloud.server: name: "{{ hcloud_server_name }}" - server_type: cax11 + server_type: "{{ hcloud_server_type_name }}" image: my-not-existing-image-20.04 state: present register: result diff --git a/tests/integration/targets/server_info/defaults/main/common.yml b/tests/integration/targets/server_info/defaults/main/common.yml index 159bb20..05fb77c 100644 --- a/tests/integration/targets/server_info/defaults/main/common.yml +++ b/tests/integration/targets/server_info/defaults/main/common.yml @@ -10,3 +10,18 @@ hcloud_prefix: "tests" hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" + +# Used to easily update the server types and images across all our tests. +hcloud_server_type_name: cax11 +hcloud_server_type_id: 45 + +hcloud_server_type_upgrade_name: cax21 +hcloud_server_type_upgrade_id: 93 + +hcloud_image_name: debian-12 +hcloud_image_id: 114690389 # architecture=arm + +hcloud_location_name: hel1 +hcloud_location_id: 3 +hcloud_datacenter_name: hel1-dc2 +hcloud_datacenter_id: 3 diff --git a/tests/integration/targets/server_info/tasks/prepare.yml b/tests/integration/targets/server_info/tasks/prepare.yml index 56b8550..4c1f395 100644 --- a/tests/integration/targets/server_info/tasks/prepare.yml +++ b/tests/integration/targets/server_info/tasks/prepare.yml @@ -2,8 +2,8 @@ - name: Create test_server hetzner.hcloud.server: name: "{{ hcloud_server_name }}" - server_type: cax11 - image: ubuntu-22.04 + server_type: "{{ hcloud_server_type_name }}" + image: "{{ hcloud_image_name }}" state: stopped labels: key: value @@ -12,8 +12,8 @@ - name: Create test_server2 (stopped + without ip) hetzner.hcloud.server: name: "{{ hcloud_server_name }}2" - server_type: cax11 - image: ubuntu-22.04 + server_type: "{{ hcloud_server_type_name }}" + image: "{{ hcloud_image_name }}" state: stopped labels: key: value diff --git a/tests/integration/targets/server_network/defaults/main/common.yml b/tests/integration/targets/server_network/defaults/main/common.yml index 159bb20..05fb77c 100644 --- a/tests/integration/targets/server_network/defaults/main/common.yml +++ b/tests/integration/targets/server_network/defaults/main/common.yml @@ -10,3 +10,18 @@ hcloud_prefix: "tests" hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" + +# Used to easily update the server types and images across all our tests. +hcloud_server_type_name: cax11 +hcloud_server_type_id: 45 + +hcloud_server_type_upgrade_name: cax21 +hcloud_server_type_upgrade_id: 93 + +hcloud_image_name: debian-12 +hcloud_image_id: 114690389 # architecture=arm + +hcloud_location_name: hel1 +hcloud_location_id: 3 +hcloud_datacenter_name: hel1-dc2 +hcloud_datacenter_id: 3 diff --git a/tests/integration/targets/server_network/tasks/prepare.yml b/tests/integration/targets/server_network/tasks/prepare.yml index a328fb8..aaadd1c 100644 --- a/tests/integration/targets/server_network/tasks/prepare.yml +++ b/tests/integration/targets/server_network/tasks/prepare.yml @@ -18,7 +18,7 @@ - name: Create test_server hetzner.hcloud.server: name: "{{ hcloud_server_name }}" - server_type: cax11 - image: ubuntu-22.04 + server_type: "{{ hcloud_server_type_name }}" + image: "{{ hcloud_image_name }}" state: stopped register: test_server diff --git a/tests/integration/targets/server_type_info/defaults/main/common.yml b/tests/integration/targets/server_type_info/defaults/main/common.yml index 159bb20..05fb77c 100644 --- a/tests/integration/targets/server_type_info/defaults/main/common.yml +++ b/tests/integration/targets/server_type_info/defaults/main/common.yml @@ -10,3 +10,18 @@ hcloud_prefix: "tests" hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" + +# Used to easily update the server types and images across all our tests. +hcloud_server_type_name: cax11 +hcloud_server_type_id: 45 + +hcloud_server_type_upgrade_name: cax21 +hcloud_server_type_upgrade_id: 93 + +hcloud_image_name: debian-12 +hcloud_image_id: 114690389 # architecture=arm + +hcloud_location_name: hel1 +hcloud_location_id: 3 +hcloud_datacenter_name: hel1-dc2 +hcloud_datacenter_id: 3 diff --git a/tests/integration/targets/server_type_info/defaults/main/main.yml b/tests/integration/targets/server_type_info/defaults/main/main.yml index 98312d9..ef29c4b 100644 --- a/tests/integration/targets/server_type_info/defaults/main/main.yml +++ b/tests/integration/targets/server_type_info/defaults/main/main.yml @@ -1,7 +1,4 @@ # Copyright: (c) 2019, Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) --- -hcloud_server_type_name: cax11 -hcloud_server_type_id: 45 - hcloud_server_type_id_deprecated: 2 # cx11-ceph diff --git a/tests/integration/targets/ssh_key/defaults/main/common.yml b/tests/integration/targets/ssh_key/defaults/main/common.yml index 159bb20..05fb77c 100644 --- a/tests/integration/targets/ssh_key/defaults/main/common.yml +++ b/tests/integration/targets/ssh_key/defaults/main/common.yml @@ -10,3 +10,18 @@ hcloud_prefix: "tests" hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" + +# Used to easily update the server types and images across all our tests. +hcloud_server_type_name: cax11 +hcloud_server_type_id: 45 + +hcloud_server_type_upgrade_name: cax21 +hcloud_server_type_upgrade_id: 93 + +hcloud_image_name: debian-12 +hcloud_image_id: 114690389 # architecture=arm + +hcloud_location_name: hel1 +hcloud_location_id: 3 +hcloud_datacenter_name: hel1-dc2 +hcloud_datacenter_id: 3 diff --git a/tests/integration/targets/ssh_key/tasks/test.yml b/tests/integration/targets/ssh_key/tasks/test.yml index 96ab3ed..3403080 100644 --- a/tests/integration/targets/ssh_key/tasks/test.yml +++ b/tests/integration/targets/ssh_key/tasks/test.yml @@ -112,8 +112,8 @@ - name: test create server with ssh key hetzner.hcloud.server: name: "{{ hcloud_server_name }}" - server_type: cax11 - image: "ubuntu-22.04" + server_type: "{{ hcloud_server_type_name }}" + image: "{{ hcloud_image_name }}" ssh_keys: - "{{ hcloud_ssh_key_name }}" state: started diff --git a/tests/integration/targets/ssh_key_info/defaults/main/common.yml b/tests/integration/targets/ssh_key_info/defaults/main/common.yml index 159bb20..05fb77c 100644 --- a/tests/integration/targets/ssh_key_info/defaults/main/common.yml +++ b/tests/integration/targets/ssh_key_info/defaults/main/common.yml @@ -10,3 +10,18 @@ hcloud_prefix: "tests" hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" + +# Used to easily update the server types and images across all our tests. +hcloud_server_type_name: cax11 +hcloud_server_type_id: 45 + +hcloud_server_type_upgrade_name: cax21 +hcloud_server_type_upgrade_id: 93 + +hcloud_image_name: debian-12 +hcloud_image_id: 114690389 # architecture=arm + +hcloud_location_name: hel1 +hcloud_location_id: 3 +hcloud_datacenter_name: hel1-dc2 +hcloud_datacenter_id: 3 diff --git a/tests/integration/targets/subnetwork/defaults/main/common.yml b/tests/integration/targets/subnetwork/defaults/main/common.yml index 159bb20..05fb77c 100644 --- a/tests/integration/targets/subnetwork/defaults/main/common.yml +++ b/tests/integration/targets/subnetwork/defaults/main/common.yml @@ -10,3 +10,18 @@ hcloud_prefix: "tests" hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" + +# Used to easily update the server types and images across all our tests. +hcloud_server_type_name: cax11 +hcloud_server_type_id: 45 + +hcloud_server_type_upgrade_name: cax21 +hcloud_server_type_upgrade_id: 93 + +hcloud_image_name: debian-12 +hcloud_image_id: 114690389 # architecture=arm + +hcloud_location_name: hel1 +hcloud_location_id: 3 +hcloud_datacenter_name: hel1-dc2 +hcloud_datacenter_id: 3 diff --git a/tests/integration/targets/volume/defaults/main/common.yml b/tests/integration/targets/volume/defaults/main/common.yml index 159bb20..05fb77c 100644 --- a/tests/integration/targets/volume/defaults/main/common.yml +++ b/tests/integration/targets/volume/defaults/main/common.yml @@ -10,3 +10,18 @@ hcloud_prefix: "tests" hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" + +# Used to easily update the server types and images across all our tests. +hcloud_server_type_name: cax11 +hcloud_server_type_id: 45 + +hcloud_server_type_upgrade_name: cax21 +hcloud_server_type_upgrade_id: 93 + +hcloud_image_name: debian-12 +hcloud_image_id: 114690389 # architecture=arm + +hcloud_location_name: hel1 +hcloud_location_id: 3 +hcloud_datacenter_name: hel1-dc2 +hcloud_datacenter_id: 3 diff --git a/tests/integration/targets/volume/tasks/test.yml b/tests/integration/targets/volume/tasks/test.yml index 3328729..55ed807 100644 --- a/tests/integration/targets/volume/tasks/test.yml +++ b/tests/integration/targets/volume/tasks/test.yml @@ -4,10 +4,10 @@ - name: setup server hetzner.hcloud.server: name: "{{hcloud_server_name}}" - server_type: cax11 - image: ubuntu-22.04 + server_type: "{{ hcloud_server_type_name }}" + image: "{{ hcloud_image_name }}" state: stopped - location: "fsn1" + location: "{{ hcloud_location_name }}" register: vol_server - name: verify setup server assert: @@ -30,7 +30,7 @@ hetzner.hcloud.volume: name: "{{hcloud_volume_name}}" size: 10 - location: "fsn1" + location: "{{ hcloud_location_name }}" register: result check_mode: true - name: verify create Volume with check mode result @@ -42,14 +42,14 @@ hetzner.hcloud.volume: name: "{{hcloud_volume_name}}" size: 10 - location: "fsn1" + location: "{{ hcloud_location_name }}" 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.location == hcloud_location_name - volume.hcloud_volume.size == 10 - volume.hcloud_volume.server != hcloud_server_name - volume.hcloud_volume.linux_device is defined @@ -58,7 +58,7 @@ hetzner.hcloud.volume: name: "{{hcloud_volume_name}}" size: 10 - location: "fsn1" + location: "{{ hcloud_location_name }}" register: volume - name: verify test create Volume assert: @@ -118,7 +118,7 @@ assert: that: - volume is changed - - volume.hcloud_volume.location == "fsn1" + - volume.hcloud_volume.location == hcloud_location_name - volume.hcloud_volume.server != hcloud_server_name - name: test update Volume label @@ -236,7 +236,7 @@ hetzner.hcloud.volume: name: "{{hcloud_volume_name}}" size: 10 - location: "fsn1" + location: "{{ hcloud_location_name }}" delete_protection: true register: volume - name: verify create Volume with delete protection diff --git a/tests/integration/targets/volume_info/defaults/main/common.yml b/tests/integration/targets/volume_info/defaults/main/common.yml index 159bb20..05fb77c 100644 --- a/tests/integration/targets/volume_info/defaults/main/common.yml +++ b/tests/integration/targets/volume_info/defaults/main/common.yml @@ -10,3 +10,18 @@ hcloud_prefix: "tests" hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" + +# Used to easily update the server types and images across all our tests. +hcloud_server_type_name: cax11 +hcloud_server_type_id: 45 + +hcloud_server_type_upgrade_name: cax21 +hcloud_server_type_upgrade_id: 93 + +hcloud_image_name: debian-12 +hcloud_image_id: 114690389 # architecture=arm + +hcloud_location_name: hel1 +hcloud_location_id: 3 +hcloud_datacenter_name: hel1-dc2 +hcloud_datacenter_id: 3 diff --git a/tests/integration/targets/volume_info/tasks/prepare.yml b/tests/integration/targets/volume_info/tasks/prepare.yml index de3c70b..f130652 100644 --- a/tests/integration/targets/volume_info/tasks/prepare.yml +++ b/tests/integration/targets/volume_info/tasks/prepare.yml @@ -3,7 +3,7 @@ hetzner.hcloud.volume: name: "{{ hcloud_volume_name }}" size: 10 - location: fsn1 + location: "{{ hcloud_location_name }}" labels: key: value register: test_volume diff --git a/tests/integration/targets/volume_info/tasks/test.yml b/tests/integration/targets/volume_info/tasks/test.yml index 7991202..f5b5f09 100644 --- a/tests/integration/targets/volume_info/tasks/test.yml +++ b/tests/integration/targets/volume_info/tasks/test.yml @@ -27,7 +27,7 @@ that: - result.hcloud_volume_info | list | count == 1 - result.hcloud_volume_info[0].name == hcloud_volume_name - - result.hcloud_volume_info[0].location == 'fsn1' + - result.hcloud_volume_info[0].location == hcloud_location_name - result.hcloud_volume_info[0].size == 10 - result.hcloud_volume_info[0].linux_device is defined