effectivelywild.technitium_dns.technitium_dns_list_dhcp_leases module – List all DHCP leases

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

New in effectivelywild.technitium_dns 0.6.0

Synopsis

  • Retrieve a list of all DHCP leases.

  • Lists both dynamic and reserved leases across all scopes.

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

validate_certs

boolean

Whether to validate SSL certificates when making API requests

Choices:

  • false

  • true ← (default)

See Also

Examples

- name: List all DHCP leases
  technitium_dns_list_dhcp_leases:
    api_url: "http://localhost"
    api_token: "myapitoken"
  register: result

- debug:
    var: result.leases

- name: Find leases for a specific MAC address
  technitium_dns_list_dhcp_leases:
    api_url: "http://localhost"
    api_token: "myapitoken"
  register: leases_result

- name: Filter for specific MAC
  set_fact:
    my_lease: "{{ leases_result.leases | selectattr('hardwareAddress', 'equalto', '00-11-22-33-44-55') | list }}"

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 list operations)

Returned: always

Sample: false

failed

boolean

Whether the module failed

Returned: always

Sample: false

leases

list / elements=dictionary

List of DHCP leases from the Technitium DNS server

Returned: always

address

string

Leased IP address

Returned: always

Sample: "192.168.1.100"

clientIdentifier

string

DHCP client identifier

Returned: always

Sample: "1-001122334455"

hardwareAddress

string

MAC address of the client

Returned: always

Sample: "00-11-22-33-44-55"

hostName

string

Hostname of the client

Returned: when available

Sample: "client.local"

leaseExpires

string

Timestamp when lease expires

Returned: always

Sample: "09/26/2020 14:27:12"

leaseObtained

string

Timestamp when lease was obtained

Returned: always

Sample: "08/25/2020 17:52:51"

scope

string

Name of the DHCP scope this lease belongs to

Returned: always

Sample: "Default"

type

string

Type of lease (Dynamic or Reserved)

Returned: always

Sample: "Dynamic"

Authors

  • Frank Muise (@effectivelywild)