# Copyright: (c) 2019, Hetzner Cloud GmbH # 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