1
0
Fork 0
mirror of https://github.com/ansible-collections/hetzner.hcloud.git synced 2026-02-04 08:01:49 +00:00
hetzner.hcloud/tests/integration/targets/server/tasks/test_primary_ips.yml
Jonas L 029a7c686b
test: update server type to cax11 (#518)
Ensure we are consistent across our tests, and updates some server types
that were missing from the previous PR updating this:

https://github.com/ansible-collections/hetzner.hcloud/pull/510
2024-06-12 10:57:12 +02:00

82 lines
2.2 KiB
YAML

# Copyright: (c) 2022, Hetzner Cloud GmbH <info@hetzner-cloud.de>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
---
- name: setup create primary ipv4
hetzner.hcloud.primary_ip:
name: "{{ hcloud_primary_ip_name }}v4"
type: ipv4
datacenter: "fsn1-dc14"
register: primaryIPv4
- name: setup create second primary ipv4
hetzner.hcloud.primary_ip:
name: "{{ hcloud_primary_ip_name }}v42"
type: ipv4
datacenter: "fsn1-dc14"
register: secondPrimaryIPv4
- name: setup create primary ipv6
hetzner.hcloud.primary_ip:
name: "{{ hcloud_primary_ip_name }}v6"
type: ipv6
datacenter: "fsn1-dc14"
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"
ipv4: "{{primaryIPv4.hcloud_primary_ip.id}}"
ipv6: "{{primaryIPv6.hcloud_primary_ip.id}}"
ssh_keys:
- "{{ hcloud_ssh_key_name }}"
state: stopped
register: result
- name: verify test create server with primary ips
assert:
that:
- result is changed
- name: test update server with primary ips
hetzner.hcloud.server:
name: "{{ hcloud_server_name }}"
server_type: cax11
datacenter: "fsn1-dc14"
image: "ubuntu-22.04"
ipv4: "{{secondPrimaryIPv4.hcloud_primary_ip.id}}"
ipv6: ""
enable_ipv6: false
ssh_keys:
- "{{ hcloud_ssh_key_name }}"
state: stopped
register: result
- name: verify test create server with primary ips
assert:
that:
- result is changed
- name: cleanup server with primary ips
hetzner.hcloud.server:
name: "{{ hcloud_server_name }}"
state: absent
- name: cleanup test create primary ips
hetzner.hcloud.primary_ip:
name: "{{ hcloud_server_name }}v4"
state: absent
- name: cleanup test create primary ips
hetzner.hcloud.primary_ip:
name: "{{ hcloud_server_name }}v42"
state: absent
until: result is not failed
retries: 5
delay: 2
- name: cleanup test create primary ips
hetzner.hcloud.primary_ip:
name: "{{ hcloud_server_name }}v6"
state: absent
until: result is not failed
retries: 5
delay: 2