effectivelywild.technitium_dns.technitium_dns_create_token module – Create an API token for a user

Note

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

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

New in effectivelywild.technitium_dns 0.5.0

Synopsis

  • Create a non-expiring API token.

  • The token allows access to API calls with the same privileges as that of the user.

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

return_token

boolean

Whether to return the actual API token value in the response

WARNING: Setting this to true will expose the sensitive API token in Ansible logs, fact cache, and console output

Choices:

  • false ← (default)

  • true

tokenName

string / required

The name of the created token to identify its session

user

string / required

The username for the user account for which to generate the API token

validate_certs

boolean

Whether to validate SSL certificates when making API requests

Choices:

  • false

  • true ← (default)

See Also

Examples

- name: Create an API token for a user
  technitium_dns_create_token:
    api_url: "http://localhost"
    api_token: "myapitoken"
    user: "testuser"
    tokenName: "MyToken1"

- name: Create API token and return the actual token value (for testing)
  technitium_dns_create_token:
    api_url: "http://localhost"
    api_token: "myapitoken"
    user: "testuser"
    tokenName: "MyToken1"
    return_token: true
  register: token_result

Return Values

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

Key

Description

api_response

dictionary

Complete raw API response from Technitium DNS

Returned: always

response

dictionary

The core data payload from the API

Returned: always

token

string

The generated API token (sensitive information) or ‘[NEW_TOKEN_HIDDEN]’ if return_token is false

Returned: always

Sample: "ddfaecb8e9325e77865ee7e100f89596a65d3eae0e6dddcb33172355b95a64af"

tokenName

string

Name of the created token

Returned: always

Sample: "MyToken1"

username

string

Username for which the token was created

Returned: always

Sample: "admin"

status

string

API response status

Returned: always

Sample: "ok"

changed

boolean

Whether the module made changes to create a new token

Returned: always

Sample: true

failed

boolean

Whether the module failed to complete the token creation

Returned: always

Sample: false

msg

string

Human-readable message describing the token creation result

Returned: always

Sample: "API token 'MyToken1' created for user 'admin'."

Authors

  • Frank Muise (@effectivelywild)