effectivelywild.technitium_dns.technitium_dns_add_record module – Add a DNS record
Note
This module is part of the effectivelywild.technitium_dns collection (version 0.4.0).
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install effectivelywild.technitium_dns
.
To use it in a playbook, specify: effectivelywild.technitium_dns.technitium_dns_add_record
.
New in effectivelywild.technitium_dns 0.1.0
Synopsis
Add a DNS record to a Technitium DNS zone.
The module supports all DNS record types.
Some parameters are only valid or required for specific record types.
For example,
ipAddress
is required for A and AAAA records, whilecname
is required for CNAME records.
Parameters
Parameter |
Comments |
---|---|
Algorithm (DS only) Choices:
|
|
ANAME target (ANAME only) |
|
Port for the Technitium DNS API. Defaults to 5380 Default: |
|
API token for authenticating with the Technitium DNS API |
|
Base URL for the Technitium DNS API |
|
Application name (APP only) |
|
Automatic IPv4 hint (SVCB and HTTPS only) Choices:
|
|
Automatic IPv6 hint (SVCB and HTTPS only) Choices:
|
|
Class path (APP only) |
|
CNAME target (CNAME only) |
|
Comments for the record |
|
Create reverse zone for PTR (A/AAAA only) Choices:
|
|
Digest (DS and SSHFP only) |
|
Digest type (DS and SSHFP only) Choices:
|
|
DNAME target (DNAME only) |
|
DNSSEC validation flag (FWD only) Choices:
|
|
MX exchange domain (MX only) |
|
Expiry in seconds for auto-deletion |
|
Flags (CAA only) |
|
Forwarder address (FWD only) |
|
Forwarder priority (FWD only) |
|
Glue address (NS only) |
|
IP address (A/AAAA only) |
|
Key tag (DS only) |
|
Responsible mailbox (MX only) |
|
The record name (e.g., test.example.com) |
|
Name server domain (NS only) |
|
Flags (NAPTR only) |
|
Order (NAPTR only) |
|
Preference (NAPTR only) |
|
Regular expression (NAPTR only) |
|
Replacement string (NAPTR only) |
|
Services (NAPTR only) |
|
Overwrite existing record set for this type Choices:
|
|
MX preference (MX only) |
|
Priority (SRV only) |
|
Protocol (FWD only) Choices:
|
|
Proxy address (FWD only) |
|
Proxy password (FWD only) |
|
Proxy port (FWD only) |
|
Proxy type (FWD only) Choices:
|
|
Proxy username (FWD only) |
|
Add reverse PTR record (A/AAAA only) Choices:
|
|
PTR domain name (PTR only) |
|
Used for adding unknown i.e. unsupported record types (UNKNOWN Only) The value must be formatted as a hex string or a colon separated hex string |
|
Record data (APP only) |
|
Split TXT into multiple strings (TXT only) Choices:
|
|
Port (SRV only) |
|
SSHFP algorithm (SSHFP only) Choices:
|
|
SSHFP fingerprint (SSHFP only) |
|
SSHFP fingerprint type (SSHFP only) Choices:
|
|
SVCB/HTTPS parameters (SVCB and HTTPS only) |
|
SVCB/HTTPS priority (SVCB and HTTPS only) |
|
SVCB/HTTPS target name (SVCB and HTTPS only) |
|
Tag (CAA only) |
|
Target (SRV only) |
|
TXT record text (TXT only) |
|
TLSA certificate association data (TLSA only) |
|
TLSA certificate usage (TLSA only) Choices:
|
|
TLSA matching type (TLSA only) Choices:
|
|
TLSA selector (TLSA only) Choices:
|
|
TTL for the record in seconds |
|
Domain for TXT record (if different from the main domain, TXT only) |
|
The DNS record type Choices:
|
|
Update SVCB/HTTPS hints (A/AAAA only) Choices:
|
|
URI target (URI only) |
|
URI priority (URI only) |
|
URI weight (URI only) |
|
Whether to validate SSL certificates when making API requests Set to false to disable SSL certificate validation Choices:
|
|
Value (CAA only) |
|
Weight (SRV only) |
|
The authoritative zone name (optional, defaults to closest match) |
See Also
See also
- effectivelywild.technitium_dns.technitium_dns_delete_record
Used to delete DNS records
- effectivelywild.technitium_dns.technitium_dns_get_record
Used to get DNS record details
Examples
# Basic A record
- name: Add an A record
technitium_dns_add_record:
api_url: "http://localhost"
api_token: "myapitoken"
name: "www.example.com"
type: "A"
ipAddress: "192.0.2.1"
ttl: 3600
validate_certs: false
# A record with PTR creation
- name: Add an A record with reverse PTR
technitium_dns_add_record:
api_url: "http://localhost"
api_token: "myapitoken"
name: "server.example.com"
zone: "example.com"
type: "A"
ipAddress: "192.0.2.10"
ptr: true
createPtrZone: true
ttl: 3600
# AAAA (IPv6) record
- name: Add an AAAA record
technitium_dns_add_record:
api_url: "http://localhost"
api_token: "myapitoken"
name: "ipv6.example.com"
zone: "example.com"
type: "AAAA"
ipAddress: "2001:db8::1"
ttl: 3600
# CNAME record
- name: Add a CNAME record
technitium_dns_add_record:
api_url: "http://localhost"
api_token: "myapitoken"
name: "alias.example.com"
zone: "example.com"
type: "CNAME"
cname: "www.example.com"
ttl: 3600
# MX record
- name: Add an MX record
technitium_dns_add_record:
api_url: "http://localhost"
api_token: "myapitoken"
name: "example.com"
zone: "example.com"
type: "MX"
exchange: "mail.example.com"
preference: 10
ttl: 3600
# TXT record
- name: Add a TXT record
technitium_dns_add_record:
api_url: "http://localhost"
api_token: "myapitoken"
name: "example.com"
zone: "example.com"
type: "TXT"
text: "v=spf1 include:_spf.google.com ~all"
ttl: 3600
# TXT record with split text
- name: Add a long TXT record with split text
technitium_dns_add_record:
api_url: "http://localhost"
api_token: "myapitoken"
name: "_dmarc.example.com"
zone: "example.com"
type: "TXT"
text: "v=DMARC1; p=quarantine; rua=mailto:dmarc@example.com; ruf=mailto:dmarc@example.com; sp=quarantine"
splitText: true
ttl: 3600
# SRV record
- name: Add an SRV record
technitium_dns_add_record:
api_url: "http://localhost"
api_token: "myapitoken"
name: "_sip._tcp.example.com"
zone: "example.com"
type: "SRV"
priority: 10
weight: 20
srv_port: 5060
target: "sip.example.com"
ttl: 3600
# NS record
- name: Add an NS record
technitium_dns_add_record:
api_url: "http://localhost"
api_token: "myapitoken"
name: "subdomain.example.com"
zone: "example.com"
type: "NS"
nameServer: "ns1.subdomain.example.com"
ttl: 86400
# NS record with glue
- name: Add an NS record with glue
technitium_dns_add_record:
api_url: "http://localhost"
api_token: "myapitoken"
name: "subdomain.example.com"
type: "NS"
nameServer: "ns1.subdomain.example.com"
glue: "192.0.2.100"
ttl: 86400
# PTR record
- name: Add a PTR record
technitium_dns_add_record:
api_url: "http://localhost"
api_token: "myapitoken"
name: "1.2.0.192.in-addr.arpa"
type: "PTR"
ptrName: "www.example.com"
ttl: 3600
# CAA record
- name: Add a CAA record
technitium_dns_add_record:
api_url: "http://localhost"
api_token: "myapitoken"
name: "example.com"
type: "CAA"
flags: 0
tag: "issue"
value: "letsencrypt.org"
ttl: 3600
# ANAME record (alias at apex)
- name: Add an ANAME record
technitium_dns_add_record:
api_url: "http://localhost"
api_token: "myapitoken"
name: "example.com"
type: "ANAME"
aname: "target.example.net"
ttl: 3600
# SSHFP record
- name: Add an SSHFP record
technitium_dns_add_record:
api_url: "http://localhost"
api_token: "myapitoken"
name: "server.example.com"
type: "SSHFP"
sshfpAlgorithm: RSA
sshfpFingerprintType: SHA256
sshfpFingerprint: "123456789abcdef67890123456789abcdef67890"
ttl: 3600
# HTTPS record
- name: Add an HTTPS record
technitium_dns_add_record:
api_url: "http://localhost"
api_token: "myapitoken"
name: "example.com"
zone: "example.com"
type: "HTTPS"
svcPriority: 1
svcTargetName: "svc.example.com"
svcParams: "alpn|h2,h3"
ttl: 3600
# SVCB record
- name: Add an SVCB record
technitium_dns_add_record:
api_url: "http://localhost"
api_token: "myapitoken"
name: "_svc.example.com"
zone: "example.com"
type: "SVCB"
svcPriority: 1
svcTargetName: "svc.example.com"
svcParams: "port|443"
ttl: 3600
# TLSA record
- name: Add a TLSA record
technitium_dns_add_record:
api_url: "http://localhost"
api_token: "myapitoken"
name: "_443._tcp.example.com"
zone: "example.com"
type: "TLSA"
tlsaCertificateUsage: PKIX-TA
tlsaSelector: Cert
tlsaMatchingType: SHA2-256
tlsaCertificateAssociationData: "abcdef1234567890abcdef1234567890abcdef12"
ttl: 3600
# URI record
- name: Add a URI record
technitium_dns_add_record:
api_url: "http://localhost"
api_token: "myapitoken"
name: "_http._tcp.example.com"
zone: "example.com"
type: "URI"
uriPriority: 10
uriWeight: 1
uri: "https://example.com/path"
ttl: 3600
# DS record
- name: Add a DS record
technitium_dns_add_record:
api_url: "http://localhost"
api_token: "myapitoken"
name: "secure.example.com"
zone: "example.com"
type: "DS"
keyTag: 12345
algorithm: RSASHA256
digestType: SHA256
digest: "abcdef1234567890abcdef1234567890abcdef1234567890"
ttl: 86400
# FWD record
- name: Add a FWD record
technitium_dns_add_record:
api_url: "http://localhost"
api_token: "myapitoken"
name: "fwdrec.fwd.example.com"
zone: "fwd.example.com"
type: "FWD"
protocol: Udp,
forwarder: 192.0.2.10
forwarderPriority: 10
# Record with overwrite and comments
- name: Add record with overwrite and comments
technitium_dns_add_record:
api_url: "http://localhost"
api_token: "myapitoken"
name: "test.example.com"
zone: "example.com"
type: "A"
ipAddress: "192.0.2.99"
ttl: 300
overwrite: true
comments: "Test server - overwrite existing"
# Record with expiry
- name: Add temporary record with expiry
technitium_dns_add_record:
api_url: "http://localhost"
api_token: "myapitoken"
name: "temp.example.com"
zone: "example.com"
type: "A"
ipAddress: "192.0.2.200"
ttl: 300
expiryTtl: 3600 # Auto-delete after 1 hour
# Using custom port and HTTPS
- name: Add record using custom API port and HTTPS
technitium_dns_add_record:
api_url: "https://dns.example.com"
api_port: 8443
api_token: "myapitoken"
name: "secure.example.com"
zone: "example.com"
type: "A"
ipAddress: "192.0.2.50"
ttl: 3600
validate_certs: true
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
The raw response from the Technitium DNS API. Returned: always |
|
The core data payload from the API. Returned: always |
|
The details of the record that was added or modified. Returned: always |
|
Whether the record is disabled. Returned: always |
|
The DNSSEC status of the record. Returned: always |
|
The record’s expiration TTL in seconds. Returned: always |
|
The record’s expiration TTL as a human-readable string. Returned: always |
|
The date and time the record was last modified. Returned: always |
|
The date and time the record was last used. Returned: always |
|
The full domain name of the record. Returned: always |
|
The data specific to the record type. Returned: always |
|
The IP address for A/AAAA records. Returned: when record is of type A or AAAA |
|
Other options that would have been passed when creating the record Returned: When option was used adding that record, don’t want to add every option here |
|
The record’s TTL in seconds. Returned: always |
|
The record’s TTL as a human-readable string. Returned: always |
|
The type of the DNS record. Returned: always |
|
Information about the zone the record belongs to. Returned: always |
|
The zone’s catalog. Returned: always |
|
Whether the zone is disabled. Returned: always |
|
The DNSSEC status of the zone. Returned: always |
|
Whether the zone is internal. Returned: always |
|
The date and time the zone was last modified. Returned: always |
|
The name of the zone. Returned: always |
|
Whether zone notification failed. Returned: always |
|
A list of hosts for which notification failed. Returned: always |
|
The SOA serial number of the zone. Returned: always |
|
The type of the zone. Returned: always |
|
The status of the API request. Returned: always |
|
A boolean indicating if the module made changes to the system. Returned: always |
|
A boolean indicating if the module failed. Returned: always |
|
A message indicating the result of the operation. Returned: always |