1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/hcloud_location_facts/tasks/main.yml
2019-03-27 10:53:54 +01:00

52 lines
1.7 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 gather hcloud location facts
hcloud_location_facts:
- name: verify test gather hcloud location facts
assert:
that:
- ansible_facts.hcloud_location_facts| list | count == 3
- name: test gather hcloud location facts in check mode
hcloud_location_facts:
check_mode: yes
- name: verify test gather hcloud location facts in check mode
assert:
that:
- ansible_facts.hcloud_location_facts| list | count == 3
- name: test gather hcloud location facts with correct name
hcloud_location_facts:
name: "{{hcloud_location_name}}"
- name: verify test gather hcloud location with correct name
assert:
that:
- ansible_facts.hcloud_location_facts|selectattr('name','equalto','{{ hcloud_location_name }}') | list | count == 1
- name: test gather hcloud location facts with wrong name
hcloud_location_facts:
name: "{{hcloud_location_name}}1"
- name: verify test gather hcloud location with wrong name
assert:
that:
- ansible_facts.hcloud_location_facts | list | count == 0
- name: test gather hcloud location facts with correct id
hcloud_location_facts:
id: "{{hcloud_location_id}}"
- name: verify test gather hcloud location with correct id
assert:
that:
- ansible_facts.hcloud_location_facts|selectattr('name','equalto','{{ hcloud_location_name }}') | list | count == 1
- name: test gather hcloud location facts with wrong id
hcloud_location_facts:
name: "4711"
- name: verify test gather hcloud location with wrong id
assert:
that:
- ansible_facts.hcloud_location_facts | list | count == 0