Debian Codegraph @

ansible_collections/community/general/tests/integration/targets/lookup_dig/tasks/main.yml

raw
1 ---
2 ####################################################################
3 # WARNING: These are designed specifically for Ansible tests #
4 # and should not be used as examples of how to write Ansible roles #
5 ####################################################################
6
7 # Copyright (c) Ansible Project
8 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
9 # SPDX-License-Identifier: GPL-3.0-or-later
10
11 - name: Install dnspython library
12 pip:
13 name: dnspython
14 state: present
15 extra_args: "-c {{ remote_constraints }}"
16
17 - name: Test dig lookup with existing domain
18 set_fact:
19 dig_existing: "{{ lookup('community.general.dig', 'github.com.') }}"
20
21 - name: Test dig lookup with non-existing domain and fail_on_error=no
22 set_fact:
23 dig_nonexisting_fail_no: "{{ lookup('community.general.dig', 'non-existing.domain.', 'fail_on_error=no') }}"
24
25 - name: Verify that NXDOMAIN was returned
26 assert:
27 that: dig_nonexisting_fail_no == 'NXDOMAIN'
28
29 - name: Test dig lookup with non-existing domain and fail_on_error=yes
30 set_fact:
31 dig_nonexisting_fail_yes: "{{ lookup('community.general.dig', 'non-existing.domain.', 'fail_on_error=yes') }}"
32 ignore_errors: true
33 register: dig_nonexisting_fail_yes_result
34
35 - name: Verify that the task failed
36 assert:
37 that: dig_nonexisting_fail_yes_result is failed