Debian Codegraph @

ansible_collections/community/dns/tests/integration/targets/lookup_reverse_lookup/tasks/main.yml

raw
1 ---
2 # Copyright (c) Ansible Project
3 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
4 # SPDX-License-Identifier: GPL-3.0-or-later
5
6 - name: Look up some records
7 ansible.builtin.set_fact:
8 ansible_a: >-
9 {{ query('community.dns.reverse_lookup', '9.9.9.9') }}
10 ansible_aaaa: >-
11 {{ query('community.dns.reverse_lookup', '2620:fe::fe') }}
12 ansible_both: >-
13 {{ query('community.dns.reverse_lookup', '9.9.9.9', '2620:fe::fe') }}
14 ansible_via_other: >-
15 {{ query('community.dns.reverse_lookup', '9.9.9.9', server=['one.one.one.one.', '8.8.8.8']) }}
16
17 - name: Check results
18 ansible.builtin.assert:
19 that:
20 - ansible_a == ['dns9.quad9.net.']
21 - ansible_aaaa == ['dns.quad9.net.']
22 - ansible_both == ['dns9.quad9.net.', 'dns.quad9.net.']
23 - ansible_via_other == ['dns9.quad9.net.']
24
25 - name: Test with invalid nameserver IP
26 ansible.builtin.set_fact:
27 broken: >-
28 {{ query('community.dns.reverse_lookup', '9.9.9.9', server='999.999.999.999') }}
29 register: result
30 ignore_errors: true
31
32 - name: Check results
33 ansible.builtin.assert:
34 that:
35 - result is failed
36 - >-
37 "Nameserver 999.999.999.999 does not exist" in result.msg