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/hcloud_server/tasks/firewalls.yml
Julian Tölle 23c2d7d228
ci: ubuntu-18.04 is deprecated/EOL (#224)
Update all references to ubuntu-18.04 (and 20.04) to 22.04, as ubuntu
18.04 is EOL and deprecated in Hetzner Cloud. This causes a CI failure
in the main branch:

https://dev.azure.com/ansible/hetzner.hcloud/_build/results?buildId=80941&view=logs&j=fdb818b8-39d8-529a-d9da-324e304604bc&t=2d52cce2-88ce-5057-da88-145e92cee00f&l=1094
2023-06-20 11:38:51 +02:00

105 lines
2.6 KiB
YAML

# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
---
- name: test add not existing firewall should fail
hcloud_server:
name: "{{ hcloud_server_name }}"
firewalls:
- not-existing
state: present
ignore_errors: yes
register: result
- name: verify add not existing firewall should fail
assert:
that:
- result is failed
- 'result.msg == "firewall not-existing was not found"'
- name: setup create firewalls
hcloud_firewall:
name: "{{ item }}"
rules:
- direction: in
protocol: icmp
source_ips:
- 0.0.0.0/0
- ::/0
with_items:
- "{{ hcloud_firewall_name }}"
- "{{ hcloud_firewall_name }}2"
- name: test create server with firewalls
hcloud_server:
name: "{{ hcloud_server_name }}"
server_type: cpx11
firewalls:
- "{{ hcloud_firewall_name }}"
image: "ubuntu-22.04"
ssh_keys:
- ci@ansible.hetzner.cloud
state: present
register: result
- name: verify test create server with firewalls
assert:
that:
- result is changed
- name: test create server with firewalls idempotence
hcloud_server:
name: "{{ hcloud_server_name }}"
server_type: cpx11
firewalls:
- "{{ hcloud_firewall_name }}"
image: "ubuntu-22.04"
ssh_keys:
- ci@ansible.hetzner.cloud
state: present
register: result
- name: verify test create server with firewalls idempotence
assert:
that:
- result is not changed
- name: test update server with firewalls
hcloud_server:
name: "{{ hcloud_server_name }}"
server_type: cpx11
firewalls:
- "{{ hcloud_firewall_name }}2"
image: "ubuntu-22.04"
ssh_keys:
- ci@ansible.hetzner.cloud
state: present
register: result
- name: verify test update server with firewalls
assert:
that:
- result is changed
- name: test update server with firewalls idempotence
hcloud_server:
name: "{{ hcloud_server_name }}"
server_type: cpx11
firewalls:
- "{{ hcloud_firewall_name }}2"
image: "ubuntu-22.04"
ssh_keys:
- ci@ansible.hetzner.cloud
state: present
register: result
- name: verify test update server with firewalls idempotence
assert:
that:
- result is not changed
- name: cleanup server with firewalls
hcloud_server:
name: "{{ hcloud_server_name }}"
state: absent
- name: cleanup test create firewall
hcloud_firewall:
name: "{{ item }}"
state: absent
with_items:
- "{{ hcloud_firewall_name }}"
- "{{ hcloud_firewall_name }}2"