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.
This commit is contained in:
Jonas L 2024-06-26 16:10:58 +02:00 committed by GitHub
parent 069b866e57
commit f3d697c006
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
64 changed files with 645 additions and 150 deletions

View file

@ -7,3 +7,18 @@ hcloud_prefix: "tests"
hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_run_ns: "{{ hcloud_prefix | md5 }}"
hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}"
hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" 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

View file

@ -10,3 +10,18 @@ hcloud_prefix: "tests"
hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_run_ns: "{{ hcloud_prefix | md5 }}"
hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}"
hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" 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

View file

@ -10,3 +10,18 @@ hcloud_prefix: "tests"
hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_run_ns: "{{ hcloud_prefix | md5 }}"
hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}"
hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" 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

View file

@ -10,3 +10,18 @@ hcloud_prefix: "tests"
hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_run_ns: "{{ hcloud_prefix | md5 }}"
hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}"
hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" 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

View file

@ -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_id: 4
hcloud_datacenter_name: fsn1-dc14
hcloud_location_name: fsn1

View file

@ -10,3 +10,18 @@ hcloud_prefix: "tests"
hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_run_ns: "{{ hcloud_prefix | md5 }}"
hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}"
hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" 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

View file

@ -2,7 +2,7 @@
- name: Create test_server - name: Create test_server
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}" name: "{{ hcloud_server_name }}"
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
image: ubuntu-22.04 image: "{{ hcloud_image_name }}"
state: stopped state: stopped
register: test_server register: test_server

View file

@ -10,3 +10,18 @@ hcloud_prefix: "tests"
hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_run_ns: "{{ hcloud_prefix | md5 }}"
hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}"
hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" 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

View file

@ -2,8 +2,8 @@
- name: Create test_server - name: Create test_server
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}" name: "{{ hcloud_server_name }}"
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
image: ubuntu-22.04 image: "{{ hcloud_image_name }}"
labels: labels:
firewall: "{{ hcloud_firewall_name }}" firewall: "{{ hcloud_firewall_name }}"
state: stopped state: stopped

View file

@ -10,3 +10,18 @@ hcloud_prefix: "tests"
hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_run_ns: "{{ hcloud_prefix | md5 }}"
hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}"
hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" 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

View file

@ -2,8 +2,8 @@
- name: Create test_server - name: Create test_server
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}" name: "{{ hcloud_server_name }}"
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
image: ubuntu-22.04 image: "{{ hcloud_image_name }}"
labels: labels:
key: value key: value
state: stopped state: stopped

View file

@ -10,3 +10,18 @@ hcloud_prefix: "tests"
hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_run_ns: "{{ hcloud_prefix | md5 }}"
hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}"
hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" 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

View file

@ -19,10 +19,10 @@
- name: setup server - name: setup server
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}" name: "{{ hcloud_server_name }}"
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
image: ubuntu-22.04 image: "{{ hcloud_image_name }}"
state: stopped state: stopped
location: "fsn1" location: "{{ hcloud_location_name }}"
register: main_server register: main_server
- name: verify setup server - name: verify setup server
assert: assert:
@ -32,8 +32,8 @@
- name: setup another server - name: setup another server
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}2" name: "{{ hcloud_server_name }}2"
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
image: ubuntu-22.04 image: "{{ hcloud_image_name }}"
state: stopped state: stopped
register: main_server2 register: main_server2
- name: verify setup another server - name: verify setup another server
@ -67,7 +67,7 @@
- name: test missing type parameter on delete Floating IP - name: test missing type parameter on delete Floating IP
hetzner.hcloud.floating_ip: hetzner.hcloud.floating_ip:
type: ipv4 type: ipv4
home_location: "fsn1" home_location: "{{ hcloud_location_name }}"
state: "absent" state: "absent"
register: result register: result
ignore_errors: true ignore_errors: true
@ -81,7 +81,7 @@
hetzner.hcloud.floating_ip: hetzner.hcloud.floating_ip:
name: "{{ hcloud_floating_ip_name }}" name: "{{ hcloud_floating_ip_name }}"
type: ipv5 type: ipv5
home_location: "fsn1" home_location: "{{ hcloud_location_name }}"
register: result register: result
ignore_errors: true ignore_errors: true
- name: verify invalid type - name: verify invalid type
@ -109,7 +109,7 @@
name: "{{ hcloud_floating_ip_name }}" name: "{{ hcloud_floating_ip_name }}"
description: "Web Server" description: "Web Server"
type: ipv4 type: ipv4
home_location: "fsn1" home_location: "{{ hcloud_location_name }}"
register: floatingIP register: floatingIP
check_mode: true check_mode: true
- name: verify test create Floating IP with check mode - name: verify test create Floating IP with check mode
@ -122,7 +122,7 @@
name: "{{ hcloud_floating_ip_name }}" name: "{{ hcloud_floating_ip_name }}"
description: "Web Server" description: "Web Server"
type: ipv4 type: ipv4
home_location: "fsn1" home_location: "{{ hcloud_location_name }}"
register: floatingIP register: floatingIP
- name: verify test create Floating IP - name: verify test create Floating IP
assert: assert:
@ -130,14 +130,14 @@
- floatingIP is changed - floatingIP is changed
- floatingIP.hcloud_floating_ip.name ==hcloud_floating_ip_name - floatingIP.hcloud_floating_ip.name ==hcloud_floating_ip_name
- floatingIP.hcloud_floating_ip.description == "Web Server" - 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 - name: test create Floating IP idempotency
hetzner.hcloud.floating_ip: hetzner.hcloud.floating_ip:
name: "{{ hcloud_floating_ip_name }}" name: "{{ hcloud_floating_ip_name }}"
description: "Web Server" description: "Web Server"
type: ipv4 type: ipv4
home_location: "fsn1" home_location: "{{ hcloud_location_name }}"
register: floatingIP register: floatingIP
- name: verify test create Floating IP idempotency - name: verify test create Floating IP idempotency
assert: assert:
@ -149,7 +149,7 @@
name: "{{ hcloud_floating_ip_name }}" name: "{{ hcloud_floating_ip_name }}"
description: "changed-description" description: "changed-description"
type: ipv4 type: ipv4
home_location: "fsn1" home_location: "{{ hcloud_location_name }}"
check_mode: true check_mode: true
register: floatingIP register: floatingIP
- name: verify test create Floating IP with check mode - name: verify test create Floating IP with check mode
@ -163,7 +163,7 @@
name: "{{ hcloud_floating_ip_name }}" name: "{{ hcloud_floating_ip_name }}"
description: "changed-description" description: "changed-description"
type: ipv4 type: ipv4
home_location: "fsn1" home_location: "{{ hcloud_location_name }}"
labels: labels:
key: value key: value
register: floatingIP register: floatingIP
@ -178,7 +178,7 @@
name: "{{ hcloud_floating_ip_name }}" name: "{{ hcloud_floating_ip_name }}"
description: "changed-description" description: "changed-description"
type: ipv4 type: ipv4
home_location: "fsn1" home_location: "{{ hcloud_location_name }}"
labels: labels:
key: value key: value
register: floatingIP register: floatingIP
@ -191,7 +191,7 @@
hetzner.hcloud.floating_ip: hetzner.hcloud.floating_ip:
name: "{{ hcloud_floating_ip_name }}" name: "{{ hcloud_floating_ip_name }}"
type: ipv4 type: ipv4
home_location: "fsn1" home_location: "{{ hcloud_location_name }}"
labels: labels:
key: value key: value
register: floatingIP register: floatingIP
@ -204,7 +204,7 @@
hetzner.hcloud.floating_ip: hetzner.hcloud.floating_ip:
name: "{{ hcloud_floating_ip_name }}" name: "{{ hcloud_floating_ip_name }}"
type: ipv4 type: ipv4
home_location: "fsn1" home_location: "{{ hcloud_location_name }}"
labels: labels:
key: value key: value
other: label other: label
@ -218,7 +218,7 @@
hetzner.hcloud.floating_ip: hetzner.hcloud.floating_ip:
name: "{{ hcloud_floating_ip_name }}" name: "{{ hcloud_floating_ip_name }}"
type: ipv4 type: ipv4
home_location: "fsn1" home_location: "{{ hcloud_location_name }}"
labels: labels:
other: label other: label
key: value key: value
@ -271,7 +271,7 @@
hetzner.hcloud.floating_ip: hetzner.hcloud.floating_ip:
name: "{{ hcloud_floating_ip_name }}" name: "{{ hcloud_floating_ip_name }}"
type: ipv4 type: ipv4
home_location: "fsn1" home_location: "{{ hcloud_location_name }}"
register: floatingIP register: floatingIP
- name: verify test unassign Floating IP - name: verify test unassign Floating IP
assert: assert:
@ -283,7 +283,7 @@
hetzner.hcloud.floating_ip: hetzner.hcloud.floating_ip:
name: "{{ hcloud_floating_ip_name }}" name: "{{ hcloud_floating_ip_name }}"
type: ipv4 type: ipv4
home_location: "fsn1" home_location: "{{ hcloud_location_name }}"
register: floatingIP register: floatingIP
- name: verify test unassign Floating IPidempotency - name: verify test unassign Floating IPidempotency
assert: assert:
@ -401,7 +401,7 @@
hetzner.hcloud.floating_ip: hetzner.hcloud.floating_ip:
name: "{{ hcloud_floating_ip_name }}" name: "{{ hcloud_floating_ip_name }}"
type: ipv6 type: ipv6
home_location: "fsn1" home_location: "{{ hcloud_location_name }}"
state: "present" state: "present"
register: result register: result
- name: verify test create ipv6 floating ip - name: verify test create ipv6 floating ip
@ -442,7 +442,7 @@
hetzner.hcloud.floating_ip: hetzner.hcloud.floating_ip:
name: "{{ hcloud_floating_ip_name }}" name: "{{ hcloud_floating_ip_name }}"
type: ipv4 type: ipv4
home_location: fsn1 home_location: "{{ hcloud_location_name }}"
delete_protection: true delete_protection: true
register: floatingIP register: floatingIP
- name: verify create Floating IP with delete protection - name: verify create Floating IP with delete protection

View file

@ -10,3 +10,18 @@ hcloud_prefix: "tests"
hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_run_ns: "{{ hcloud_prefix | md5 }}"
hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}"
hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" 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

View file

@ -2,7 +2,7 @@
- name: Create test_floating_ip - name: Create test_floating_ip
hetzner.hcloud.floating_ip: hetzner.hcloud.floating_ip:
name: "{{ hcloud_floating_ip_name }}" name: "{{ hcloud_floating_ip_name }}"
home_location: fsn1 home_location: "{{ hcloud_location_name }}"
type: ipv4 type: ipv4
labels: labels:
key: value key: value

View file

@ -10,3 +10,18 @@ hcloud_prefix: "tests"
hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_run_ns: "{{ hcloud_prefix | md5 }}"
hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}"
hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" 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

View file

@ -3,4 +3,3 @@
--- ---
hcloud_server_name: "{{ hcloud_ns }}" hcloud_server_name: "{{ hcloud_ns }}"
hcloud_snapshot_name: "{{ hcloud_ns }}" hcloud_snapshot_name: "{{ hcloud_ns }}"
hcloud_image_name: ubuntu-22.04

View file

@ -2,8 +2,8 @@
- name: Create test_server - name: Create test_server
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}" name: "{{ hcloud_server_name }}"
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
image: ubuntu-22.04 image: "{{ hcloud_image_name }}"
state: stopped state: stopped
register: test_server register: test_server

View file

@ -10,3 +10,18 @@ hcloud_prefix: "tests"
hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_run_ns: "{{ hcloud_prefix | md5 }}"
hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}"
hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" 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

View file

@ -10,3 +10,18 @@ hcloud_prefix: "tests"
hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_run_ns: "{{ hcloud_prefix | md5 }}"
hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}"
hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" 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

View file

@ -10,3 +10,18 @@ hcloud_prefix: "tests"
hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_run_ns: "{{ hcloud_prefix | md5 }}"
hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}"
hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" 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

View file

@ -2,8 +2,8 @@
- name: Create test_server - name: Create test_server
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}" name: "{{ hcloud_server_name }}"
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
image: ubuntu-22.04 image: "{{ hcloud_image_name }}"
state: stopped state: stopped
register: test_server register: test_server

View file

@ -10,3 +10,18 @@ hcloud_prefix: "tests"
hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_run_ns: "{{ hcloud_prefix | md5 }}"
hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}"
hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" 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

View file

@ -30,7 +30,7 @@
name: "{{hcloud_load_balancer_name}}" name: "{{hcloud_load_balancer_name}}"
load_balancer_type: lb11 load_balancer_type: lb11
state: present state: present
location: "fsn1" location: "{{ hcloud_location_name }}"
register: load_balancer register: load_balancer
- name: verify setup load_balancer - name: verify setup load_balancer
assert: assert:

View file

@ -10,3 +10,18 @@ hcloud_prefix: "tests"
hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_run_ns: "{{ hcloud_prefix | md5 }}"
hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}"
hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" 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

View file

@ -6,7 +6,7 @@
name: "{{hcloud_load_balancer_name}}" name: "{{hcloud_load_balancer_name}}"
load_balancer_type: lb11 load_balancer_type: lb11
state: present state: present
location: "fsn1" location: "{{ hcloud_location_name }}"
register: load_balancer register: load_balancer
- name: verify setup load_balancer - name: verify setup load_balancer
assert: assert:

View file

@ -10,3 +10,18 @@ hcloud_prefix: "tests"
hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_run_ns: "{{ hcloud_prefix | md5 }}"
hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}"
hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" 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

View file

@ -4,10 +4,10 @@
- name: setup server - name: setup server
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{hcloud_server_name}}" name: "{{hcloud_server_name}}"
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
image: ubuntu-22.04 image: "{{ hcloud_image_name }}"
state: stopped state: stopped
location: "fsn1" location: "{{ hcloud_location_name }}"
register: server register: server
- name: verify setup server - name: verify setup server
assert: assert:
@ -19,7 +19,7 @@
name: "{{hcloud_load_balancer_name}}" name: "{{hcloud_load_balancer_name}}"
load_balancer_type: lb11 load_balancer_type: lb11
state: present state: present
location: "fsn1" location: "{{ hcloud_location_name }}"
register: load_balancer register: load_balancer
- name: verify setup load_balancer - name: verify setup load_balancer
assert: assert:

View file

@ -10,3 +10,18 @@ hcloud_prefix: "tests"
hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_run_ns: "{{ hcloud_prefix | md5 }}"
hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}"
hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" 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

View file

@ -10,3 +10,18 @@ hcloud_prefix: "tests"
hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_run_ns: "{{ hcloud_prefix | md5 }}"
hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}"
hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" 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

View file

@ -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_id: 1
hcloud_location_name: fsn1

View file

@ -10,3 +10,18 @@ hcloud_prefix: "tests"
hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_run_ns: "{{ hcloud_prefix | md5 }}"
hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}"
hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" 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

View file

@ -10,3 +10,18 @@ hcloud_prefix: "tests"
hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_run_ns: "{{ hcloud_prefix | md5 }}"
hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}"
hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" 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

View file

@ -10,3 +10,18 @@ hcloud_prefix: "tests"
hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_run_ns: "{{ hcloud_prefix | md5 }}"
hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}"
hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" 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

View file

@ -64,9 +64,9 @@
- name: test create server with placement group - name: test create server with placement group
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}" name: "{{ hcloud_server_name }}"
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
placement_group: "{{ hcloud_placement_group_name }}" placement_group: "{{ hcloud_placement_group_name }}"
image: "ubuntu-22.04" image: "{{ hcloud_image_name }}"
ssh_keys: ssh_keys:
- "{{ hcloud_ssh_key_name }}" - "{{ hcloud_ssh_key_name }}"
state: present state: present

View file

@ -10,3 +10,18 @@ hcloud_prefix: "tests"
hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_run_ns: "{{ hcloud_prefix | md5 }}"
hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}"
hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" 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

View file

@ -2,8 +2,8 @@
- name: Create test_server - name: Create test_server
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}" name: "{{ hcloud_server_name }}"
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
image: ubuntu-22.04 image: "{{ hcloud_image_name }}"
state: stopped state: stopped
enable_ipv4: false enable_ipv4: false
enable_ipv6: false enable_ipv6: false

View file

@ -16,7 +16,7 @@
hetzner.hcloud.primary_ip: hetzner.hcloud.primary_ip:
name: "{{ hcloud_primary_ip_name }}" name: "{{ hcloud_primary_ip_name }}"
type: ipv6 type: ipv6
datacenter: fsn1-dc14 datacenter: "{{ hcloud_datacenter_name }}"
labels: labels:
key: value key: value
check_mode: true check_mode: true
@ -30,7 +30,7 @@
hetzner.hcloud.primary_ip: hetzner.hcloud.primary_ip:
name: "{{ hcloud_primary_ip_name }}" name: "{{ hcloud_primary_ip_name }}"
type: ipv6 type: ipv6
datacenter: fsn1-dc14 datacenter: "{{ hcloud_datacenter_name }}"
labels: labels:
key: value key: value
register: result register: result
@ -40,7 +40,7 @@
- result is changed - result is changed
- result.hcloud_primary_ip.name == hcloud_primary_ip_name - result.hcloud_primary_ip.name == hcloud_primary_ip_name
- result.hcloud_primary_ip.type == "ipv6" - 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_type == "server"
- result.hcloud_primary_ip.assignee_id is none - result.hcloud_primary_ip.assignee_id is none
- result.hcloud_primary_ip.labels.key == "value" - result.hcloud_primary_ip.labels.key == "value"
@ -51,7 +51,7 @@
hetzner.hcloud.primary_ip: hetzner.hcloud.primary_ip:
name: "{{ hcloud_primary_ip_name }}" name: "{{ hcloud_primary_ip_name }}"
type: ipv6 type: ipv6
datacenter: fsn1-dc14 datacenter: "{{ hcloud_datacenter_name }}"
labels: labels:
key: value key: value
register: result register: result
@ -64,7 +64,7 @@
hetzner.hcloud.primary_ip: hetzner.hcloud.primary_ip:
name: "{{ hcloud_primary_ip_name }}" name: "{{ hcloud_primary_ip_name }}"
type: ipv6 type: ipv6
datacenter: fsn1-dc14 datacenter: "{{ hcloud_datacenter_name }}"
labels: labels:
key: value key: value
foo: bar foo: bar
@ -76,7 +76,7 @@
- result is changed - result is changed
- result.hcloud_primary_ip.name == hcloud_primary_ip_name - result.hcloud_primary_ip.name == hcloud_primary_ip_name
- result.hcloud_primary_ip.type == "ipv6" - 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_type == "server"
- result.hcloud_primary_ip.assignee_id is none - result.hcloud_primary_ip.assignee_id is none
- result.hcloud_primary_ip.labels.key == "value" - result.hcloud_primary_ip.labels.key == "value"
@ -88,7 +88,7 @@
hetzner.hcloud.primary_ip: hetzner.hcloud.primary_ip:
name: "{{ hcloud_primary_ip_name }}" name: "{{ hcloud_primary_ip_name }}"
type: ipv6 type: ipv6
datacenter: fsn1-dc14 datacenter: "{{ hcloud_datacenter_name }}"
labels: labels:
key: value key: value
foo: bar foo: bar

View file

@ -10,3 +10,18 @@ hcloud_prefix: "tests"
hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_run_ns: "{{ hcloud_prefix | md5 }}"
hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}"
hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" 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

View file

@ -2,7 +2,7 @@
- name: Create test_primary_ip - name: Create test_primary_ip
hetzner.hcloud.primary_ip: hetzner.hcloud.primary_ip:
name: "{{ hcloud_primary_ip_name }}" name: "{{ hcloud_primary_ip_name }}"
datacenter: fsn1-dc14 datacenter: "{{ hcloud_datacenter_name }}"
type: ipv4 type: ipv4
labels: labels:
key: value key: value

View file

@ -10,3 +10,18 @@ hcloud_prefix: "tests"
hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_run_ns: "{{ hcloud_prefix | md5 }}"
hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}"
hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" 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

View file

@ -2,8 +2,8 @@
- name: Create test_server - name: Create test_server
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}" name: "{{ hcloud_server_name }}"
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
image: ubuntu-22.04 image: "{{ hcloud_image_name }}"
state: present state: present
register: test_server register: test_server
@ -11,7 +11,7 @@
hetzner.hcloud.primary_ip: hetzner.hcloud.primary_ip:
name: "{{ hcloud_primary_ip_name }}" name: "{{ hcloud_primary_ip_name }}"
type: ipv4 type: ipv4
datacenter: fsn1-dc14 datacenter: "{{ hcloud_datacenter_name }}"
state: present state: present
register: test_primary_ip register: test_primary_ip
@ -19,7 +19,7 @@
hetzner.hcloud.floating_ip: hetzner.hcloud.floating_ip:
name: "{{ hcloud_floating_ip_name }}" name: "{{ hcloud_floating_ip_name }}"
type: ipv4 type: ipv4
home_location: fsn1 home_location: "{{ hcloud_location_name }}"
state: present state: present
register: test_floating_ip register: test_floating_ip

View file

@ -10,3 +10,18 @@ hcloud_prefix: "tests"
hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_run_ns: "{{ hcloud_prefix | md5 }}"
hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}"
hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" 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

View file

@ -10,3 +10,18 @@ hcloud_prefix: "tests"
hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_run_ns: "{{ hcloud_prefix | md5 }}"
hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}"
hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" 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

View file

@ -1,8 +1,8 @@
- name: test create server with check mode - name: test create server with check mode
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}" name: "{{ hcloud_server_name }}"
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
image: ubuntu-22.04 image: "{{ hcloud_image_name }}"
state: present state: present
register: result register: result
check_mode: true check_mode: true
@ -14,8 +14,8 @@
- name: test create server - name: test create server
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name}}" name: "{{ hcloud_server_name}}"
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
image: ubuntu-22.04 image: "{{ hcloud_image_name }}"
enable_ipv6: False enable_ipv6: False
state: started state: started
register: main_server register: main_server
@ -24,7 +24,7 @@
that: that:
- main_server is changed - main_server is changed
- main_server.hcloud_server.name == hcloud_server_name - 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.hcloud_server.status == "running"
- main_server.root_password != "" - main_server.root_password != ""
@ -108,7 +108,7 @@
- name: test resize server running without force - name: test resize server running without force
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}" name: "{{ hcloud_server_name }}"
server_type: "cax21" server_type: "{{ hcloud_server_type_upgrade_name }}"
state: present state: present
register: result register: result
check_mode: true check_mode: true
@ -116,12 +116,12 @@
assert: assert:
that: that:
- result is changed - 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 - name: test resize server with check mode
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}" name: "{{ hcloud_server_name }}"
server_type: "cax21" server_type: "{{ hcloud_server_type_upgrade_name }}"
state: stopped state: stopped
register: result register: result
check_mode: true check_mode: true
@ -133,19 +133,19 @@
- name: test resize server without disk - name: test resize server without disk
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}" name: "{{ hcloud_server_name }}"
server_type: "cax21" server_type: "{{ hcloud_server_type_upgrade_name }}"
state: stopped state: stopped
register: result register: result
- name: verify resize server without disk - name: verify resize server without disk
assert: assert:
that: that:
- result is changed - result is changed
- result.hcloud_server.server_type == "cax21" - result.hcloud_server.server_type == hcloud_server_type_upgrade_name
- name: test resize server idempotence - name: test resize server idempotence
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}" name: "{{ hcloud_server_name }}"
server_type: "cax21" server_type: "{{ hcloud_server_type_upgrade_name }}"
state: stopped state: stopped
register: result register: result
- name: verify resize server idempotence - name: verify resize server idempotence
@ -156,19 +156,19 @@
- name: test resize server to smaller plan - name: test resize server to smaller plan
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}" name: "{{ hcloud_server_name }}"
server_type: "cax11" server_type: "{{ hcloud_server_type_name }}"
state: stopped state: stopped
register: result register: result
- name: verify resize server to smaller plan - name: verify resize server to smaller plan
assert: assert:
that: that:
- result is changed - result is changed
- result.hcloud_server.server_type == "cax11" - result.hcloud_server.server_type == hcloud_server_type_name
- name: test resize server with disk - name: test resize server with disk
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}" name: "{{ hcloud_server_name }}"
server_type: "cax21" server_type: "{{ hcloud_server_type_upgrade_name }}"
upgrade_disk: true upgrade_disk: true
state: stopped state: stopped
register: result register: result
@ -176,7 +176,7 @@
assert: assert:
that: that:
- result is changed - 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 - name: test enable backups with check mode
hetzner.hcloud.server: hetzner.hcloud.server:
@ -232,7 +232,7 @@
- name: test rebuild server - name: test rebuild server
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}" name: "{{ hcloud_server_name }}"
image: ubuntu-22.04 image: "{{ hcloud_image_name }}"
state: rebuild state: rebuild
register: result_after_test register: result_after_test
- name: verify rebuild server - name: verify rebuild server
@ -244,7 +244,7 @@
- name: test rebuild server with check mode - name: test rebuild server with check mode
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}" name: "{{ hcloud_server_name }}"
image: ubuntu-22.04 image: "{{ hcloud_image_name }}"
state: rebuild state: rebuild
register: result_after_test register: result_after_test
check_mode: true check_mode: true
@ -321,7 +321,7 @@
- name: test rebuild server fails if it is protected - name: test rebuild server fails if it is protected
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{hcloud_server_name}}" name: "{{hcloud_server_name}}"
image: ubuntu-22.04 image: "{{ hcloud_image_name }}"
state: rebuild state: rebuild
ignore_errors: true ignore_errors: true
register: result register: result
@ -360,8 +360,8 @@
- name: test create server with ssh key - name: test create server with ssh key
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name}}" name: "{{ hcloud_server_name}}"
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
image: "ubuntu-22.04" image: "{{ hcloud_image_name }}"
ssh_keys: ssh_keys:
- "{{ hcloud_ssh_key_name }}" - "{{ hcloud_ssh_key_name }}"
state: started state: started
@ -371,7 +371,7 @@
that: that:
- main_server is changed - main_server is changed
- main_server.hcloud_server.name == hcloud_server_name - 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.hcloud_server.status == "running"
- main_server.root_password != "" - main_server.root_password != ""
@ -441,8 +441,8 @@
- name: test create server with rescue_mode - name: test create server with rescue_mode
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name}}" name: "{{ hcloud_server_name}}"
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
image: "ubuntu-22.04" image: "{{ hcloud_image_name }}"
ssh_keys: ssh_keys:
- "{{ hcloud_ssh_key_name }}" - "{{ hcloud_ssh_key_name }}"
rescue_mode: "linux64" rescue_mode: "linux64"
@ -453,7 +453,7 @@
that: that:
- main_server is changed - main_server is changed
- main_server.hcloud_server.name == hcloud_server_name - 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.hcloud_server.status == "running"
- main_server.root_password != "" - main_server.root_password != ""
- main_server.hcloud_server.rescue_enabled is sameas true - main_server.hcloud_server.rescue_enabled is sameas true
@ -470,8 +470,8 @@
- name: test create server with labels - name: test create server with labels
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name}}" name: "{{ hcloud_server_name}}"
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
image: "ubuntu-22.04" image: "{{ hcloud_image_name }}"
ssh_keys: ssh_keys:
- "{{ hcloud_ssh_key_name }}" - "{{ hcloud_ssh_key_name }}"
labels: labels:
@ -489,8 +489,8 @@
- name: test update server with labels - name: test update server with labels
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name}}" name: "{{ hcloud_server_name}}"
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
image: "ubuntu-22.04" image: "{{ hcloud_image_name }}"
ssh_keys: ssh_keys:
- "{{ hcloud_ssh_key_name }}" - "{{ hcloud_ssh_key_name }}"
labels: labels:
@ -508,8 +508,8 @@
- name: test update server with labels in other order - name: test update server with labels in other order
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name}}" name: "{{ hcloud_server_name}}"
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
image: "ubuntu-22.04" image: "{{ hcloud_image_name }}"
ssh_keys: ssh_keys:
- "{{ hcloud_ssh_key_name }}" - "{{ hcloud_ssh_key_name }}"
labels: labels:
@ -535,9 +535,9 @@
- name: test create server with enabled backups - name: test create server with enabled backups
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}" name: "{{ hcloud_server_name }}"
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
backups: true backups: true
image: "ubuntu-22.04" image: "{{ hcloud_image_name }}"
ssh_keys: ssh_keys:
- "{{ hcloud_ssh_key_name }}" - "{{ hcloud_ssh_key_name }}"
state: present state: present
@ -563,8 +563,8 @@
name: "{{ hcloud_server_name }}" name: "{{ hcloud_server_name }}"
delete_protection: true delete_protection: true
rebuild_protection: true rebuild_protection: true
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
image: "ubuntu-22.04" image: "{{ hcloud_image_name }}"
ssh_keys: ssh_keys:
- "{{ hcloud_ssh_key_name }}" - "{{ hcloud_ssh_key_name }}"
state: present state: present

View file

@ -32,10 +32,10 @@
- name: test create server with firewalls - name: test create server with firewalls
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}" name: "{{ hcloud_server_name }}"
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
firewalls: firewalls:
- "{{ hcloud_firewall_name }}" - "{{ hcloud_firewall_name }}"
image: "ubuntu-22.04" image: "{{ hcloud_image_name }}"
ssh_keys: ssh_keys:
- "{{ hcloud_ssh_key_name }}" - "{{ hcloud_ssh_key_name }}"
state: present state: present
@ -48,10 +48,10 @@
- name: test create server with firewalls idempotence - name: test create server with firewalls idempotence
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}" name: "{{ hcloud_server_name }}"
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
firewalls: firewalls:
- "{{ hcloud_firewall_name }}" - "{{ hcloud_firewall_name }}"
image: "ubuntu-22.04" image: "{{ hcloud_image_name }}"
ssh_keys: ssh_keys:
- "{{ hcloud_ssh_key_name }}" - "{{ hcloud_ssh_key_name }}"
state: present state: present
@ -64,10 +64,10 @@
- name: test update server with firewalls - name: test update server with firewalls
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}" name: "{{ hcloud_server_name }}"
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
firewalls: firewalls:
- "{{ hcloud_firewall_name }}2" - "{{ hcloud_firewall_name }}2"
image: "ubuntu-22.04" image: "{{ hcloud_image_name }}"
ssh_keys: ssh_keys:
- "{{ hcloud_ssh_key_name }}" - "{{ hcloud_ssh_key_name }}"
state: present state: present
@ -80,10 +80,10 @@
- name: test update server with firewalls idempotence - name: test update server with firewalls idempotence
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}" name: "{{ hcloud_server_name }}"
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
firewalls: firewalls:
- "{{ hcloud_firewall_name }}2" - "{{ hcloud_firewall_name }}2"
image: "ubuntu-22.04" image: "{{ hcloud_image_name }}"
ssh_keys: ssh_keys:
- "{{ hcloud_ssh_key_name }}" - "{{ hcloud_ssh_key_name }}"
state: present state: present

View file

@ -5,29 +5,29 @@
hetzner.hcloud.primary_ip: hetzner.hcloud.primary_ip:
name: "{{ hcloud_primary_ip_name }}v4" name: "{{ hcloud_primary_ip_name }}v4"
type: ipv4 type: ipv4
datacenter: "fsn1-dc14" datacenter: "{{ hcloud_datacenter_name }}"
register: primaryIPv4 register: primaryIPv4
- name: setup create second primary ipv4 - name: setup create second primary ipv4
hetzner.hcloud.primary_ip: hetzner.hcloud.primary_ip:
name: "{{ hcloud_primary_ip_name }}v42" name: "{{ hcloud_primary_ip_name }}v42"
type: ipv4 type: ipv4
datacenter: "fsn1-dc14" datacenter: "{{ hcloud_datacenter_name }}"
register: secondPrimaryIPv4 register: secondPrimaryIPv4
- name: setup create primary ipv6 - name: setup create primary ipv6
hetzner.hcloud.primary_ip: hetzner.hcloud.primary_ip:
name: "{{ hcloud_primary_ip_name }}v6" name: "{{ hcloud_primary_ip_name }}v6"
type: ipv6 type: ipv6
datacenter: "fsn1-dc14" datacenter: "{{ hcloud_datacenter_name }}"
register: primaryIPv6 register: primaryIPv6
- name: test create server with primary ips - name: test create server with primary ips
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}" name: "{{ hcloud_server_name }}"
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
datacenter: "fsn1-dc14" datacenter: "{{ hcloud_datacenter_name }}"
image: "ubuntu-22.04" image: "{{ hcloud_image_name }}"
ipv4: "{{primaryIPv4.hcloud_primary_ip.id}}" ipv4: "{{primaryIPv4.hcloud_primary_ip.id}}"
ipv6: "{{primaryIPv6.hcloud_primary_ip.id}}" ipv6: "{{primaryIPv6.hcloud_primary_ip.id}}"
ssh_keys: ssh_keys:
@ -42,9 +42,9 @@
- name: test update server with primary ips - name: test update server with primary ips
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}" name: "{{ hcloud_server_name }}"
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
datacenter: "fsn1-dc14" datacenter: "{{ hcloud_datacenter_name }}"
image: "ubuntu-22.04" image: "{{ hcloud_image_name }}"
ipv4: "{{secondPrimaryIPv4.hcloud_primary_ip.id}}" ipv4: "{{secondPrimaryIPv4.hcloud_primary_ip.id}}"
ipv6: "" ipv6: ""
enable_ipv6: false enable_ipv6: false

View file

@ -63,9 +63,9 @@
- name: test create server with primary network and no internet - name: test create server with primary network and no internet
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}" name: "{{ hcloud_server_name }}"
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
datacenter: "fsn1-dc14" datacenter: "{{ hcloud_datacenter_name }}"
image: "ubuntu-22.04" image: "{{ hcloud_image_name }}"
enable_ipv4: false enable_ipv4: false
enable_ipv6: false enable_ipv6: false
private_networks: private_networks:
@ -82,9 +82,9 @@
- name: test update server by adding secondary network - name: test update server by adding secondary network
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}" name: "{{ hcloud_server_name }}"
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
datacenter: "fsn1-dc14" datacenter: "{{ hcloud_datacenter_name }}"
image: "ubuntu-22.04" image: "{{ hcloud_image_name }}"
enable_ipv4: false enable_ipv4: false
enable_ipv6: false enable_ipv6: false
private_networks: private_networks:
@ -102,9 +102,9 @@
- name: test update server idem - name: test update server idem
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}" name: "{{ hcloud_server_name }}"
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
datacenter: "fsn1-dc14" datacenter: "{{ hcloud_datacenter_name }}"
image: "ubuntu-22.04" image: "{{ hcloud_image_name }}"
enable_ipv4: false enable_ipv4: false
enable_ipv6: false enable_ipv6: false
private_networks: private_networks:

View file

@ -26,7 +26,7 @@
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}" name: "{{ hcloud_server_name }}"
server_type: not-existing-server-type server_type: not-existing-server-type
image: ubuntu-22.04 image: "{{ hcloud_image_name }}"
state: present state: present
register: result register: result
ignore_errors: true ignore_errors: true
@ -40,7 +40,7 @@
- name: test create server with not existing image - name: test create server with not existing image
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}" name: "{{ hcloud_server_name }}"
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
image: my-not-existing-image-20.04 image: my-not-existing-image-20.04
state: present state: present
register: result register: result

View file

@ -10,3 +10,18 @@ hcloud_prefix: "tests"
hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_run_ns: "{{ hcloud_prefix | md5 }}"
hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}"
hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" 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

View file

@ -2,8 +2,8 @@
- name: Create test_server - name: Create test_server
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}" name: "{{ hcloud_server_name }}"
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
image: ubuntu-22.04 image: "{{ hcloud_image_name }}"
state: stopped state: stopped
labels: labels:
key: value key: value
@ -12,8 +12,8 @@
- name: Create test_server2 (stopped + without ip) - name: Create test_server2 (stopped + without ip)
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}2" name: "{{ hcloud_server_name }}2"
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
image: ubuntu-22.04 image: "{{ hcloud_image_name }}"
state: stopped state: stopped
labels: labels:
key: value key: value

View file

@ -10,3 +10,18 @@ hcloud_prefix: "tests"
hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_run_ns: "{{ hcloud_prefix | md5 }}"
hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}"
hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" 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

View file

@ -18,7 +18,7 @@
- name: Create test_server - name: Create test_server
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}" name: "{{ hcloud_server_name }}"
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
image: ubuntu-22.04 image: "{{ hcloud_image_name }}"
state: stopped state: stopped
register: test_server register: test_server

View file

@ -10,3 +10,18 @@ hcloud_prefix: "tests"
hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_run_ns: "{{ hcloud_prefix | md5 }}"
hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}"
hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" 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

View file

@ -1,7 +1,4 @@
# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de> # 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) # 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 hcloud_server_type_id_deprecated: 2 # cx11-ceph

View file

@ -10,3 +10,18 @@ hcloud_prefix: "tests"
hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_run_ns: "{{ hcloud_prefix | md5 }}"
hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}"
hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" 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

View file

@ -112,8 +112,8 @@
- name: test create server with ssh key - name: test create server with ssh key
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{ hcloud_server_name }}" name: "{{ hcloud_server_name }}"
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
image: "ubuntu-22.04" image: "{{ hcloud_image_name }}"
ssh_keys: ssh_keys:
- "{{ hcloud_ssh_key_name }}" - "{{ hcloud_ssh_key_name }}"
state: started state: started

View file

@ -10,3 +10,18 @@ hcloud_prefix: "tests"
hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_run_ns: "{{ hcloud_prefix | md5 }}"
hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}"
hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" 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

View file

@ -10,3 +10,18 @@ hcloud_prefix: "tests"
hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_run_ns: "{{ hcloud_prefix | md5 }}"
hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}"
hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" 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

View file

@ -10,3 +10,18 @@ hcloud_prefix: "tests"
hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_run_ns: "{{ hcloud_prefix | md5 }}"
hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}"
hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" 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

View file

@ -4,10 +4,10 @@
- name: setup server - name: setup server
hetzner.hcloud.server: hetzner.hcloud.server:
name: "{{hcloud_server_name}}" name: "{{hcloud_server_name}}"
server_type: cax11 server_type: "{{ hcloud_server_type_name }}"
image: ubuntu-22.04 image: "{{ hcloud_image_name }}"
state: stopped state: stopped
location: "fsn1" location: "{{ hcloud_location_name }}"
register: vol_server register: vol_server
- name: verify setup server - name: verify setup server
assert: assert:
@ -30,7 +30,7 @@
hetzner.hcloud.volume: hetzner.hcloud.volume:
name: "{{hcloud_volume_name}}" name: "{{hcloud_volume_name}}"
size: 10 size: 10
location: "fsn1" location: "{{ hcloud_location_name }}"
register: result register: result
check_mode: true check_mode: true
- name: verify create Volume with check mode result - name: verify create Volume with check mode result
@ -42,14 +42,14 @@
hetzner.hcloud.volume: hetzner.hcloud.volume:
name: "{{hcloud_volume_name}}" name: "{{hcloud_volume_name}}"
size: 10 size: 10
location: "fsn1" location: "{{ hcloud_location_name }}"
register: volume register: volume
- name: verify test create Volume - name: verify test create Volume
assert: assert:
that: that:
- volume is changed - volume is changed
- volume.hcloud_volume.name == hcloud_volume_name - 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.size == 10
- volume.hcloud_volume.server != hcloud_server_name - volume.hcloud_volume.server != hcloud_server_name
- volume.hcloud_volume.linux_device is defined - volume.hcloud_volume.linux_device is defined
@ -58,7 +58,7 @@
hetzner.hcloud.volume: hetzner.hcloud.volume:
name: "{{hcloud_volume_name}}" name: "{{hcloud_volume_name}}"
size: 10 size: 10
location: "fsn1" location: "{{ hcloud_location_name }}"
register: volume register: volume
- name: verify test create Volume - name: verify test create Volume
assert: assert:
@ -118,7 +118,7 @@
assert: assert:
that: that:
- volume is changed - volume is changed
- volume.hcloud_volume.location == "fsn1" - volume.hcloud_volume.location == hcloud_location_name
- volume.hcloud_volume.server != hcloud_server_name - volume.hcloud_volume.server != hcloud_server_name
- name: test update Volume label - name: test update Volume label
@ -236,7 +236,7 @@
hetzner.hcloud.volume: hetzner.hcloud.volume:
name: "{{hcloud_volume_name}}" name: "{{hcloud_volume_name}}"
size: 10 size: 10
location: "fsn1" location: "{{ hcloud_location_name }}"
delete_protection: true delete_protection: true
register: volume register: volume
- name: verify create Volume with delete protection - name: verify create Volume with delete protection

View file

@ -10,3 +10,18 @@ hcloud_prefix: "tests"
hcloud_run_ns: "{{ hcloud_prefix | md5 }}" hcloud_run_ns: "{{ hcloud_prefix | md5 }}"
hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}" hcloud_role_ns: "{{ role_name | split('_') | map('batch', 2) | map('first') | flatten() | join() }}"
hcloud_ns: "ansible-{{ hcloud_run_ns }}-{{ hcloud_role_ns }}" 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

View file

@ -3,7 +3,7 @@
hetzner.hcloud.volume: hetzner.hcloud.volume:
name: "{{ hcloud_volume_name }}" name: "{{ hcloud_volume_name }}"
size: 10 size: 10
location: fsn1 location: "{{ hcloud_location_name }}"
labels: labels:
key: value key: value
register: test_volume register: test_volume

View file

@ -27,7 +27,7 @@
that: that:
- result.hcloud_volume_info | list | count == 1 - result.hcloud_volume_info | list | count == 1
- result.hcloud_volume_info[0].name == hcloud_volume_name - 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].size == 10
- result.hcloud_volume_info[0].linux_device is defined - result.hcloud_volume_info[0].linux_device is defined