test: clean ressources before testing (#228)

This commit is contained in:
Jonas L 2023-06-21 10:39:11 +02:00 committed by GitHub
parent 584e904c29
commit 97c84e93a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 1 deletions

View file

@ -1,6 +1,21 @@
# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
---
- name: setup ensure server is absent
hcloud_server:
name: "{{ hcloud_server_name }}"
state: absent
- name: setup ensure another server is absent
hcloud_server:
name: "{{ hcloud_server_name }}2"
state: absent
- name: setup ensure floating ip is absent
hcloud_floating_ip:
name: "{{ hcloud_floating_ip_name }}"
state: absent
- name: setup server
hcloud_server:
name: "{{ hcloud_server_name }}"
@ -62,7 +77,6 @@
- result is failed
- 'result.msg == "one of the following is required: id, name"'
- name: test invalid type
hcloud_floating_ip:
name: "{{ hcloud_floating_ip_name }}"

View file

@ -1,6 +1,11 @@
# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
---
- name: setup ensure primary ip is absent
hcloud_primary_ip:
name: "{{ hcloud_primary_ip_name }}"
state: absent
- name: test create Primary IP with check mode
hcloud_primary_ip:
name: "{{ hcloud_primary_ip_name }}"