effectivelywild.technitium_dns.technitium_dns_login module – Authenticate and get a session token

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. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: effectivelywild.technitium_dns.technitium_dns_login.

New in effectivelywild.technitium_dns 1.0.0

Synopsis

  • Authenticates with the Technitium DNS server using username and password.

  • Generates a session token that can be used for subsequent API calls.

  • Session tokens expire based on user’s session expiry timeout (default 30 minutes from last API call).

  • Useful when API tokens have been invalidated, such as after joining a cluster.

Requirements

The below requirements are needed on the host that executes this module.

  • Technitium DNS Server v14.0 or later

Parameters

Parameter

Comments

api_port

integer

Port for the Technitium DNS API. Defaults to 5380

Default: 5380

api_url

string / required

Base URL for the Technitium DNS API

include_info

boolean

Include basic user info and permissions in the response.

Choices:

  • false

  • true ← (default)

password

string / required

The password for the user account.

The default password for admin user is ‘admin’.

totp

string

The time-based one-time password if 2FA is enabled for the user account.

username

string / required

The username for the user account.

The built-in administrator username is ‘admin’.

validate_certs

boolean

Whether to validate SSL certificates when making API requests.

Choices:

  • false

  • true ← (default)

Notes

Note

  • This operation requires no permissions (it’s the authentication endpoint).

  • The session token returned expires after the configured session timeout.

  • It is recommended to change default passwords on first use.

Examples

- name: Login and get session token
  effectivelywild.technitium_dns.technitium_dns_login:
    api_url: "http://localhost"
    username: "admin"
    password: "admin"
  register: login_result

- name: Display session token
  debug:
    var: login_result.token

- name: Login with 2FA
  effectivelywild.technitium_dns.technitium_dns_login:
    api_url: "http://localhost"
    username: "admin"
    password: "mypassword"
    totp: "123456"
  register: login_result

- name: Login and get user info
  effectivelywild.technitium_dns.technitium_dns_login:
    api_url: "http://localhost"
    username: "admin"
    password: "admin"
    include_info: true
  register: login_result

- name: Use session token in subsequent calls
  effectivelywild.technitium_dns.technitium_dns_get_cluster_state:
    api_url: "http://localhost"
    api_token: "{{ login_result.token }}"
  register: cluster_state

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

changed

boolean

Whether the module made changes (always false for login)

Returned: always

Sample: false

display_name

string

Display name of the authenticated user

Returned: always

Sample: "Administrator"

failed

boolean

Whether the module failed

Returned: always

Sample: false

info

dictionary

User information and permissions (when include_info is true)

Returned: when include_info is true

defaultRecordTtl

integer

Default TTL for records

Returned: success

Sample: 3600

dnsServerDomain

string

DNS server domain name

Returned: success

Sample: "server1"

permissions

dictionary

User permissions for various sections

Returned: success

version

string

Technitium DNS Server version

Returned: success

Sample: "14.0"

msg

string

Status message

Returned: always

Sample: "Login successful"

token

string

Session token to use for subsequent API calls

Returned: always

Sample: "932b2a3495852c15af01598f62563ae534460388b6a370bfbbb8bb6094b698e9"

totp_enabled

boolean

Whether 2FA is enabled for this user

Returned: always

Sample: false

username

string

Username of the authenticated user

Returned: always

Sample: "admin"

Authors

  • Frank Muise (@effectivelywild)