mirror of
https://github.com/ansible-collections/hetzner.hcloud.git
synced 2026-02-03 23:51:48 +00:00
##### SUMMARY This simplifies the name of the modules from `hetzner.hcloud.hcloud_firewall` to `hetzner.hcloud.firewall`. While maintaining backward compatibility with the old names. Further changes such as updating the test or the documentation will be done in a future PR to maintain the git history when squashing the PRs. ##### ISSUE TYPE - Feature Pull Request
104 lines
3.3 KiB
YAML
104 lines
3.3 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: Gather hcloud_image_info
|
|
hetzner.hcloud.hcloud_image_info:
|
|
register: result
|
|
- name: Verify hcloud_image_info
|
|
ansible.builtin.assert:
|
|
that:
|
|
- result.hcloud_image_info | list | count >= 3
|
|
|
|
- name: Gather hcloud_image_info with architecture
|
|
hetzner.hcloud.hcloud_image_info:
|
|
architecture: arm
|
|
register: result
|
|
- name: Verify hcloud_image_info with architecture
|
|
ansible.builtin.assert:
|
|
that:
|
|
- result.hcloud_image_info | selectattr('architecture', 'equalto', 'x86') | list | count == 0
|
|
- result.hcloud_image_info | selectattr('architecture', 'equalto', 'arm') | list | count > 2
|
|
|
|
- name: Gather hcloud_image_info in check mode
|
|
hetzner.hcloud.hcloud_image_info:
|
|
check_mode: true
|
|
register: result
|
|
- name: Verify hcloud_image_info in check mode
|
|
ansible.builtin.assert:
|
|
that:
|
|
- result.hcloud_image_info | list | count >= 3
|
|
|
|
- name: Gather hcloud_image_info with correct id
|
|
hetzner.hcloud.hcloud_image_info:
|
|
id: "{{ test_snapshot_id }}"
|
|
type: snapshot
|
|
register: result
|
|
- name: Verify hcloud_image_info with correct id
|
|
ansible.builtin.assert:
|
|
that:
|
|
- result.hcloud_image_info | list | count == 1
|
|
|
|
- name: Gather hcloud_image_info with wrong id
|
|
hetzner.hcloud.hcloud_image_info:
|
|
id: "{{ test_snapshot_id }}4321"
|
|
type: snapshot
|
|
ignore_errors: true
|
|
register: result
|
|
- name: Verify hcloud_image_info with wrong id
|
|
ansible.builtin.assert:
|
|
that:
|
|
- result is failed
|
|
|
|
- name: Gather hcloud_image_info with correct name
|
|
hetzner.hcloud.hcloud_image_info:
|
|
name: "{{ hcloud_image_name }}"
|
|
register: result
|
|
- name: Verify hcloud_image_info with correct name
|
|
ansible.builtin.assert:
|
|
that:
|
|
- result.hcloud_image_info | list | count == 1
|
|
- result.hcloud_image_info[0].architecture == "x86"
|
|
|
|
- name: Gather hcloud_image_info with wrong name
|
|
hetzner.hcloud.hcloud_image_info:
|
|
name: "{{ hcloud_image_name }}-invalid"
|
|
register: result
|
|
- name: Verify hcloud_image_info with wrong name
|
|
ansible.builtin.assert:
|
|
that:
|
|
- result.hcloud_image_info | list | count == 0
|
|
|
|
- name: Gather hcloud_image_info with correct name and architecture
|
|
hetzner.hcloud.hcloud_image_info:
|
|
name: "{{ hcloud_image_name }}"
|
|
architecture: arm
|
|
register: result
|
|
- name: Verify hcloud_image_info with correct name
|
|
ansible.builtin.assert:
|
|
that:
|
|
- result.hcloud_image_info | list | count == 1
|
|
- result.hcloud_image_info[0].architecture == "arm"
|
|
|
|
- name: Gather hcloud_image_info with correct label selector
|
|
hetzner.hcloud.hcloud_image_info:
|
|
label_selector: "key=value"
|
|
type: snapshot
|
|
register: result
|
|
- name: Verify hcloud_image_info with correct label selector
|
|
ansible.builtin.assert:
|
|
that:
|
|
# Snapshot names are stored in the description field
|
|
- >
|
|
result.hcloud_image_info
|
|
| selectattr('description', 'equalto', '{{ hcloud_snapshot_name }}')
|
|
| list | count == 1
|
|
|
|
- name: Gather hcloud_image_info with wrong label selector
|
|
hetzner.hcloud.hcloud_image_info:
|
|
label_selector: "key!=value"
|
|
type: snapshot
|
|
register: result
|
|
- name: Verify hcloud_image_info with wrong label selector
|
|
ansible.builtin.assert:
|
|
that:
|
|
- result.hcloud_image_info | list | count == 0
|