effectivelywild.technitium_dns.technitium_dns_record module – Manage DNS records

Note

This module is part of the effectivelywild.technitium_dns collection (version 1.1.2).

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_record.

New in effectivelywild.technitium_dns 1.0.0

Synopsis

  • Manage DNS records, add, update, and delete.

  • Supports all DNS record types with type-specific parameters.

  • Singleton record types (one record per name) include APP, CNAME, and DNAME.

  • All other record types support multiple records per name.

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)

Requires ptr=true; otherwise Technitium ignores this setting

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 (RP 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)

node

string

The node domain name for which this API call is intended

When unspecified, the current node is used

This parameter can be used only when Clustering is initialized

overwrite

boolean

Overwrite existing record set for this type (only applies to state=present)

Choices:

  • false

  • true ← (default)

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)

records

list / elements=dictionary

List of records to create for the DNS name

Each record is a dictionary containing the type-specific parameters

Use this to create multiple records of the same type for a single DNS name

Mutually exclusive with using shorthand parameters (ipAddress, cname, etc.)

When overwrite=true (default), replaces all existing records with the specified list

When overwrite=false, adds records to existing set

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"

state

string

The desired state of the DNS record.

present ensures the record exists with the specified parameters.

absent ensures the record does not exist.

Choices:

  • "present" ← (default)

  • "absent"

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

See also

effectivelywild.technitium_dns.technitium_dns_get_record

Used to get DNS record details

Examples

# Basic A record - ensure present
- name: Ensure A record exists
  effectivelywild.technitium_dns.technitium_dns_record:
    api_url: "http://localhost"
    api_token: "myapitoken"
    name: "www.example.com"
    type: "A"
    ipAddress: "192.0.2.1"
    ttl: 3600
    state: present

# Basic A record - ensure absent
- name: Ensure A record is removed
  effectivelywild.technitium_dns.technitium_dns_record:
    api_url: "http://localhost"
    api_token: "myapitoken"
    name: "www.example.com"
    type: "A"
    ipAddress: "192.0.2.1"
    state: absent

# Using with loops - much cleaner than before!
- name: Manage multiple DNS records
  effectivelywild.technitium_dns.technitium_dns_record:
    api_url: "https://{{ dnsserver_domain }}"
    api_token: "{{ api_token }}"
    zone: "{{ item.zone }}"
    name: "{{ item.domain }}"
    type: "{{ item.type }}"
    ipAddress: "{{ item.ipAddress }}"
    ttl: "{{ item.ttl }}"
    comments: "{{ item.comments }}"
    state: "{{ item.state | default('present') }}"
  loop: "{{ dnsserver_records }}"
  loop_control:
    label: "{{ item.domain }}"

# CNAME record
- name: Ensure CNAME record exists
  effectivelywild.technitium_dns.technitium_dns_record:
    api_url: "http://localhost"
    api_token: "myapitoken"
    name: "alias.example.com"
    zone: "example.com"
    type: "CNAME"
    cname: "www.example.com"
    ttl: 3600
    state: present

# MX record
- name: Ensure MX record exists
  effectivelywild.technitium_dns.technitium_dns_record:
    api_url: "http://localhost"
    api_token: "myapitoken"
    name: "example.com"
    zone: "example.com"
    type: "MX"
    exchange: "mail.example.com"
    preference: 10
    ttl: 3600
    state: present

# TXT record with overwrite
- name: Ensure TXT record exists (overwrite if different)
  effectivelywild.technitium_dns.technitium_dns_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
    overwrite: true
    state: present

# A record with PTR
- name: Ensure A record with reverse PTR exists
  effectivelywild.technitium_dns.technitium_dns_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
    state: present

# Multiple A records using records parameter
- name: Create multiple A records for round-robin DNS
  effectivelywild.technitium_dns.technitium_dns_record:
    api_url: "http://localhost"
    api_token: "myapitoken"
    name: "web.example.com"
    zone: "example.com"
    type: "A"
    ttl: 3600
    records:
      - ipAddress: "192.0.2.10"
      - ipAddress: "192.0.2.11"
      - ipAddress: "192.0.2.12"
    state: present

# Multiple MX records using records parameter
- name: Create multiple MX records
  effectivelywild.technitium_dns.technitium_dns_record:
    api_url: "http://localhost"
    api_token: "myapitoken"
    name: "example.com"
    zone: "example.com"
    type: "MX"
    ttl: 3600
    records:
      - exchange: "mail1.example.com"
        preference: 10
      - exchange: "mail2.example.com"
        preference: 20
      - exchange: "mail3.example.com"
        preference: 30
    state: present

# Multiple TXT records using records parameter
- name: Create multiple TXT records for SPF and DKIM
  effectivelywild.technitium_dns.technitium_dns_record:
    api_url: "http://localhost"
    api_token: "myapitoken"
    name: "example.com"
    zone: "example.com"
    type: "TXT"
    ttl: 3600
    records:
      - text: "v=spf1 include:_spf.google.com ~all"
      - text: "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQ..."
    state: present

# SRV records using records parameter
- name: Create SRV records for service discovery
  effectivelywild.technitium_dns.technitium_dns_record:
    api_url: "http://localhost"
    api_token: "myapitoken"
    name: "_ldap._tcp.example.com"
    zone: "example.com"
    type: "SRV"
    ttl: 3600
    records:
      - priority: 10
        weight: 60
        port: 389
        target: "ldap1.example.com"
      - priority: 10
        weight: 40
        port: 389
        target: "ldap2.example.com"
    state: present

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: when state=present

addedRecord

dictionary

The details of the record that was added or modified.

Returned: when state=present

disabled

boolean

Whether the record is disabled.

Returned: always

name

string

The full domain name of the record.

Returned: always

rData

dictionary

The data specific to the record type.

Returned: always

ttl

integer

The record’s TTL in seconds.

Returned: always

type

string

The type of the DNS record.

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)