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 (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) Requires 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 (RP 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) |
|
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 existing record set for this type (only applies to state=present) 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) |
|
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 When |
|
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:
|
|
The desired state of the DNS record.
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_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 |
|---|---|
The raw response from the Technitium DNS API. Returned: always |
|
The core data payload from the API. Returned: when state=present |
|
The details of the record that was added or modified. Returned: when state=present |
|
Whether the record is disabled. Returned: always |
|
The full domain name of the record. Returned: always |
|
The data specific to the record type. Returned: always |
|
The record’s TTL in seconds. Returned: always |
|
The type of the DNS record. 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 |