1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

[PR #5913/451c9025 backport][stable-6] dig lookup: support CAA record type (#5917)

dig lookup: support CAA record type (#5913)

* Support CAA record type.

* Update return docs.

(cherry picked from commit 451c90251a)

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
patchback[bot] 2023-01-29 18:37:18 +01:00 committed by GitHub
parent 61324ed9eb
commit 24cf561135
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- "dig lookup plugin - support CAA record type (https://github.com/ansible-collections/community.general/pull/5913)."

View file

@ -35,9 +35,10 @@ DOCUMENTATION = '''
description: description:
- Record type to query. - Record type to query.
- C(DLV) has been removed in community.general 6.0.0. - C(DLV) has been removed in community.general 6.0.0.
- C(CAA) has been added in community.general 6.3.0.
type: str type: str
default: 'A' default: 'A'
choices: [A, ALL, AAAA, CNAME, DNAME, DNSKEY, DS, HINFO, LOC, MX, NAPTR, NS, NSEC3PARAM, PTR, RP, RRSIG, SOA, SPF, SRV, SSHFP, TLSA, TXT] choices: [A, ALL, AAAA, CAA, CNAME, DNAME, DNSKEY, DS, HINFO, LOC, MX, NAPTR, NS, NSEC3PARAM, PTR, RP, RRSIG, SOA, SPF, SRV, SSHFP, TLSA, TXT]
flat: flat:
description: If 0 each record is returned as a dictionary, otherwise a string. description: If 0 each record is returned as a dictionary, otherwise a string.
type: int type: int
@ -129,6 +130,12 @@ RETURN = """
AAAA: AAAA:
description: description:
- address - address
CAA:
description:
- flags
- tag
- value
version_added: 6.3.0
CNAME: CNAME:
description: description:
- target - target
@ -198,7 +205,7 @@ try:
import dns.resolver import dns.resolver
import dns.reversename import dns.reversename
import dns.rdataclass import dns.rdataclass
from dns.rdatatype import (A, AAAA, CNAME, DNAME, DNSKEY, DS, HINFO, LOC, from dns.rdatatype import (A, AAAA, CAA, CNAME, DNAME, DNSKEY, DS, HINFO, LOC,
MX, NAPTR, NS, NSEC3PARAM, PTR, RP, SOA, SPF, SRV, SSHFP, TLSA, TXT) MX, NAPTR, NS, NSEC3PARAM, PTR, RP, SOA, SPF, SRV, SSHFP, TLSA, TXT)
HAVE_DNS = True HAVE_DNS = True
except ImportError: except ImportError:
@ -218,6 +225,7 @@ def make_rdata_dict(rdata):
supported_types = { supported_types = {
A: ['address'], A: ['address'],
AAAA: ['address'], AAAA: ['address'],
CAA: ['flags', 'tag', 'value'],
CNAME: ['target'], CNAME: ['target'],
DNAME: ['target'], DNAME: ['target'],
DNSKEY: ['flags', 'algorithm', 'protocol', 'key'], DNSKEY: ['flags', 'algorithm', 'protocol', 'key'],