effectivelywild.technitium_dns.technitium_dns_zone module – Manage DNS zones with state-based approach

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

New in effectivelywild.technitium_dns 1.0.0

Synopsis

  • Manage DNS zones in Technitium DNS Server.

  • Supports all zone types with type-specific parameters.

Parameters

Parameter

Comments

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

catalog

string

The name of the catalog zone to become its member zone

dnssec

boolean

Enable DNSSEC for the zone

When enabled, the zone will be signed with DNSSEC

Choices:

  • false

  • true

dnssecValidation

boolean

Enable DNSSEC validation (Forwarder only)

Choices:

  • false

  • true

forwarder

string

Address of DNS server to use as forwarder (Forwarder only)

initializeForwarder

boolean

Initialize Conditional Forwarder zone with FWD record (Forwarder only)

Choices:

  • false

  • true

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

primaryNameServerAddresses

list / elements=string

List of primary name server IP addresses or names (Secondary, SecondaryForwarder, SecondaryCatalog, Stub)

protocol

string

DNS transport protocol for Conditional Forwarder zone

Choices:

  • "Udp"

  • "Tcp"

  • "Tls"

  • "Https"

  • "Quic"

proxyAddress

string

Proxy server address (Forwarder only)

proxyPassword

string

Proxy server password (Forwarder only)

proxyPort

integer

Proxy server port (Forwarder only)

proxyType

string

Proxy type for conditional forwarding (Forwarder only)

Choices:

  • "NoProxy"

  • "DefaultProxy"

  • "Http"

  • "Socks5"

proxyUsername

string

Proxy server username (Forwarder only)

state

string

The desired state of the DNS zone

present ensures the zone exists with the specified parameters

absent ensures the zone does not exist

Choices:

  • "present" ← (default)

  • "absent"

tsigKeyName

string

TSIG key name (Secondary, SecondaryForwarder, SecondaryCatalog)

type

string

The type of zone to be created

Required when state=present

Choices:

  • "Primary"

  • "Secondary"

  • "Stub"

  • "Forwarder"

  • "SecondaryForwarder"

  • "Catalog"

  • "SecondaryCatalog"

useSoaSerialDateScheme

boolean

Enable using date scheme for SOA serial (Primary, Forwarder, Catalog zones)

Choices:

  • false

  • true

validate_certs

boolean

Whether to validate SSL certificates when making API requests

Choices:

  • false

  • true ← (default)

validateZone

boolean

Enable ZONEMD validation (Secondary only)

Choices:

  • false

  • true

zone

string / required

The domain name of the zone

zoneTransferProtocol

string

Zone transfer protocol (Secondary, SecondaryForwarder, SecondaryCatalog)

Choices:

  • "Tcp"

  • "Tls"

  • "Quic"

See Also

Examples

# Basic Primary zone
- name: Ensure Primary zone exists
  effectivelywild.technitium_dns.technitium_dns_zone:
    api_url: "http://localhost"
    api_token: "myapitoken"
    zone: "example.com"
    type: "Primary"
    state: present

# Primary zone with DNSSEC
- name: Create Primary zone with DNSSEC enabled
  effectivelywild.technitium_dns.technitium_dns_zone:
    api_url: "http://localhost"
    api_token: "myapitoken"
    zone: "secure.example.com"
    type: "Primary"
    dnssec: true
    state: present

# Forwarder zone
- name: Create Forwarder zone
  effectivelywild.technitium_dns.technitium_dns_zone:
    api_url: "http://localhost"
    api_token: "myapitoken"
    zone: "forward.example.com"
    type: "Forwarder"
    forwarder: "8.8.8.8"
    initializeForwarder: true
    protocol: "Udp"
    state: present

# Secondary zone
- name: Create Secondary zone
  effectivelywild.technitium_dns.technitium_dns_zone:
    api_url: "http://localhost"
    api_token: "myapitoken"
    zone: "secondary.example.com"
    type: "Secondary"
    primaryNameServerAddresses:
      - "192.0.2.1"
      - "192.0.2.2"
    zoneTransferProtocol: "Tcp"
    state: present

# Delete a zone
- name: Ensure zone is absent
  effectivelywild.technitium_dns.technitium_dns_zone:
    api_url: "http://localhost"
    api_token: "myapitoken"
    zone: "example.com"
    state: absent

# Using with loops
- name: Manage multiple DNS zones
  effectivelywild.technitium_dns.technitium_dns_zone:
    api_url: "https://{{ dnsserver_domain }}"
    api_token: "{{ api_token }}"
    zone: "{{ item.zone }}"
    type: "{{ item.type }}"
    state: "{{ item.state | default('present') }}"
  loop: "{{ dns_zones }}"
  loop_control:
    label: "{{ item.zone }}"

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

status

string

API response status.

Returned: always

Sample: "ok"

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)