Skip to content

Commit

Permalink
dns-record: Minor update
Browse files Browse the repository at this point in the history
Check if DNS records exist using pdnsutil instead of dns queries,
because they could be cached.
  • Loading branch information
arodier committed Jul 16, 2024
1 parent 605c7ac commit bb816d7
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions roles/dns-record/tasks/install/dns.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@
query: '{{ network.domain }}'
tags: dns

- name: Check if the record exists with dig
- name: Check if the record exists with pdnsutil
register: check_record
ansible.builtin.shell: >-
set -o pipefail ;
dig +nocomments +noall +answer
-q {{ query }}
-t {{ record.type | upper }}
@{{ pdns.ip }}
pdnsutil list-zone
| grep '^{{ query | regex_escape }} '
| grep ' {{ record.type | upper }} '
| grep -c '{{ record.search | default(record.value) | regex_escape }}'
args:
executable: /usr/bin/bash
Expand Down

0 comments on commit bb816d7

Please sign in to comment.