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, while cname is required for CNAME records.

Parameters

Parameter

Comments

algorithm

string

Algorithm (DS only)

Choices:

  • "RSAMD5"

  • "DSA"

  • "RSASHA1"

  • "DSA-NSEC3-SHA1"

  • "RSASHA1-NSEC3-SHA1"

  • "RSASHA256"

  • "RSASHA512"

  • "ECC-GOST"

  • "ECDSAP256SHA256"

  • "ECDSAP384SHA384"

  • "ED25519"

  • "ED448"

aname

string

ANAME target (ANAME only)

api_port

integer

Port for the Technitium DNS API. Defaults to 5380

Default: 5380

api_token

string / required

API token for authenticating with the Technitium DNS API

api_url

string / required

Base URL for the Technitium DNS API

appName

string

Application name (APP only)

autoIpv4Hint

boolean

Automatic IPv4 hint (SVCB and HTTPS only)

Choices:

  • false

  • true

autoIpv6Hint

boolean

Automatic IPv6 hint (SVCB and HTTPS only)

Choices:

  • false

  • true

classPath

string

Class path (APP only)

cname

string

CNAME target (CNAME only)

comments

string

Comments for the record

createPtrZone

boolean

Create reverse zone for PTR (A/AAAA only)

Choices:

  • false

  • true

digest

string

Digest (DS and SSHFP only)

digestType

string

Digest type (DS and SSHFP only)

Choices:

  • "SHA1"

  • "SHA256"

  • "GOST-R-34-11-94"

  • "SHA384"

dname

string

DNAME target (DNAME only)

dnssecValidation

boolean

DNSSEC validation flag (FWD only)

Choices:

  • false

  • true

exchange

string

MX exchange domain (MX only)

expiryTtl

integer

Expiry in seconds for auto-deletion

flags

string

Flags (CAA only)

forwarder

string

Forwarder address (FWD only)

forwarderPriority

integer

Forwarder priority (FWD only)

glue

string

Glue address (NS only)

ipAddress

string

IP address (A/AAAA only)

keyTag

integer

Key tag (DS only)

mailbox

string

Responsible mailbox (MX only)

name

aliases: domain

string / required

The record name (e.g., test.example.com)

nameServer

string

Name server domain (NS only)

naptrFlags

string

Flags (NAPTR only)

naptrOrder

integer

Order (NAPTR only)

naptrPreference

integer

Preference (NAPTR only)

naptrRegexp

string

Regular expression (NAPTR only)

naptrReplacement

string

Replacement string (NAPTR only)

naptrServices

string

Services (NAPTR only)

overwrite

boolean

Overwrite existing record set for this type

Choices:

  • false ← (default)

  • true

preference

integer

MX preference (MX only)

priority

integer

Priority (SRV only)

protocol

string

Protocol (FWD only)

Choices:

  • "Udp"

  • "Tcp"

  • "Tls"

  • "Https"

  • "Quic"

proxyAddress

string

Proxy address (FWD only)

proxyPassword

string

Proxy password (FWD only)

proxyPort

integer

Proxy port (FWD only)

proxyType

string

Proxy type (FWD only)

Choices:

  • "NoProxy"

  • "DefaultProxy"

  • "Http"

  • "Socks5"

proxyUsername

string

Proxy username (FWD only)

ptr

boolean

Add reverse PTR record (A/AAAA only)

Choices:

  • false

  • true

ptrName

string

PTR domain name (PTR only)

rdata

string

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

recordData

string

Record data (APP only)

splitText

boolean

Split TXT into multiple strings (TXT only)

Choices:

  • false

  • true

srv_port

integer

Port (SRV only)

sshfpAlgorithm

string

SSHFP algorithm (SSHFP only)

Choices:

  • "RSA"

  • "DSA"

  • "ECDSA"

  • "Ed25519"

  • "Ed448"

sshfpFingerprint

string

SSHFP fingerprint (SSHFP only)

sshfpFingerprintType

string

SSHFP fingerprint type (SSHFP only)

Choices:

  • "SHA1"

  • "SHA256"

svcParams

string

SVCB/HTTPS parameters (SVCB and HTTPS only)

svcPriority

integer

SVCB/HTTPS priority (SVCB and HTTPS only)

svcTargetName

string

SVCB/HTTPS target name (SVCB and HTTPS only)

tag

string

Tag (CAA only)

target

string

Target (SRV only)

text

string

TXT record text (TXT only)

tlsaCertificateAssociationData

string

TLSA certificate association data (TLSA only)

tlsaCertificateUsage

string

TLSA certificate usage (TLSA only)

Choices:

  • "PKIX-TA"

  • "PKIX-EE"

  • "DANE-TA"

  • "DANE-EE"

tlsaMatchingType

string

TLSA matching type (TLSA only)

Choices:

  • "Full"

  • "SHA2-256"

  • "SHA2-512"

tlsaSelector

string

TLSA selector (TLSA only)

Choices:

  • "Cert"

  • "SPKI"

ttl

integer

TTL for the record in seconds

txtDomain

string

Domain for TXT record (if different from the main domain, TXT only)

type

string / required

The DNS record type

Choices:

  • "A"

  • "AAAA"

  • "ANAME"

  • "APP"

  • "CNAME"

  • "CAA"

  • "DNAME"

  • "DS"

  • "FWD"

  • "HTTPS"

  • "MX"

  • "NAPTR"

  • "NS"

  • "PTR"

  • "SSHFP"

  • "SRV"

  • "SVCB"

  • "TLSA"

  • "TXT"

  • "UNKNOWN"

  • "URI"

updateSvcbHints

boolean

Update SVCB/HTTPS hints (A/AAAA only)

Choices:

  • false

  • true

uri

string

URI target (URI only)

uriPriority

integer

URI priority (URI only)

uriWeight

integer

URI weight (URI only)

validate_certs

boolean

Whether to validate SSL certificates when making API requests

Set to false to disable SSL certificate validation

Choices:

  • false

  • true ← (default)

value

string

Value (CAA only)

weight

integer

Weight (SRV only)

zone

string

The authoritative zone name (optional, defaults to closest match)

See Also

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

api_response

dictionary

The raw response from the Technitium DNS API.

Returned: always

response

dictionary

The core data payload from the API.

Returned: always

addedRecord

dictionary

The details of the record that was added or modified.

Returned: always

disabled

boolean

Whether the record is disabled.

Returned: always

dnssecStatus

string

The DNSSEC status of the record.

Returned: always

expiryTtl

integer

The record’s expiration TTL in seconds.

Returned: always

expiryTtlString

string

The record’s expiration TTL as a human-readable string.

Returned: always

lastModified

string

The date and time the record was last modified.

Returned: always

lastUsedOn

string

The date and time the record was last used.

Returned: always

name

string

The full domain name of the record.

Returned: always

rData

dictionary

The data specific to the record type.

Returned: always

ipAddress

string

The IP address for A/AAAA records.

Returned: when record is of type A or AAAA

otherOptions

string

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

ttl

integer

The record’s TTL in seconds.

Returned: always

ttlString

string

The record’s TTL as a human-readable string.

Returned: always

type

string

The type of the DNS record.

Returned: always

zone

dictionary

Information about the zone the record belongs to.

Returned: always

catalog

string

The zone’s catalog.

Returned: always

disabled

boolean

Whether the zone is disabled.

Returned: always

dnssecStatus

string

The DNSSEC status of the zone.

Returned: always

internal

boolean

Whether the zone is internal.

Returned: always

lastModified

string

The date and time the zone was last modified.

Returned: always

name

string

The name of the zone.

Returned: always

notifyFailed

boolean

Whether zone notification failed.

Returned: always

notifyFailedFor

list / elements=string

A list of hosts for which notification failed.

Returned: always

soaSerial

integer

The SOA serial number of the zone.

Returned: always

type

string

The type of the zone.

Returned: always

status

string

The status of the API request.

Returned: always

changed

boolean

A boolean indicating if the module made changes to the system.

Returned: always

failed

boolean

A boolean indicating if the module failed.

Returned: always

msg

string

A message indicating the result of the operation.

Returned: always

Authors

  • Frank Muise (@effectivelywild)