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 |
|---|---|
Port for the Technitium DNS API. Defaults to 5380 Default: |
|
Base URL for the Technitium DNS API |
|
Include basic user info and permissions in the response. Choices:
|
|
The password for the user account. The default password for admin user is ‘admin’. |
|
The time-based one-time password if 2FA is enabled for the user account. |
|
The username for the user account. The built-in administrator username is ‘admin’. |
|
Whether to validate SSL certificates when making API requests. Choices:
|
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 |
|---|---|
Whether the module made changes (always false for login) Returned: always Sample: |
|
Display name of the authenticated user Returned: always Sample: |
|
Whether the module failed Returned: always Sample: |
|
User information and permissions (when include_info is true) Returned: when include_info is true |
|
Default TTL for records Returned: success Sample: |
|
DNS server domain name Returned: success Sample: |
|
User permissions for various sections Returned: success |
|
Technitium DNS Server version Returned: success Sample: |
|
Status message Returned: always Sample: |
|
Session token to use for subsequent API calls Returned: always Sample: |
|
Whether 2FA is enabled for this user Returned: always Sample: |
|
Username of the authenticated user Returned: always Sample: |