effectivelywild.technitium_dns.technitium_dns_set_dhcp_scope module – Set DHCP scope configuration

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

New in effectivelywild.technitium_dns 0.6.0

Synopsis

  • Set or create DHCP scope configuration.

  • If the scope does not exist, it will be created.

Parameters

Parameter

Comments

allowOnlyReservedLeases

boolean

Stop dynamic IP address allocation and allocate only reserved IP addresses

Choices:

  • false

  • true

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

blockLocallyAdministeredMacAddresses

boolean

Stop dynamic IP address allocation for clients with locally administered MAC addresses

Choices:

  • false

  • true

bootFileName

string

The boot file name stored on the bootstrap TFTP server to be used by clients

capwapAcIpAddresses

list / elements=string

List of CAPWAP Access Controller IP addresses for Wireless Termination Points

dnsServers

list / elements=string

List of DNS server IP addresses to be used by the clients

Ignored when useThisDnsServer is set to true

dnsTtl

integer

The TTL value in seconds used for forward and reverse DNS records

dnsUpdates

boolean

Allow the DHCP server to automatically update forward and reverse DNS entries for clients

Choices:

  • false

  • true

domainName

string

The domain name to be used by this network

The DHCP server automatically adds forward and reverse DNS entries when configured

domainSearchList

list / elements=string

List of domain names that clients can use as a suffix when searching a domain name

endingAddress

string

The ending IP address of the DHCP scope

Required when creating a new scope

exclusions

list / elements=dictionary

List of IP address ranges to exclude from dynamic allocation

endingAddress

string / required

Ending IP address of exclusion range

startingAddress

string / required

Starting IP address of exclusion range

genericOptions

list / elements=dictionary

List of generic DHCP options not directly supported

code

integer / required

DHCP option code

value

string / required

Option value as colon-separated or normal hex string

ignoreClientIdentifierOption

boolean

Always use the client’s MAC address as the identifier instead of Client Identifier option

Choices:

  • false

  • true

leaseTimeDays

integer

The lease time in number of days

leaseTimeHours

integer

The lease time in number of hours

leaseTimeMinutes

integer

The lease time in number of minutes

name

string / required

The name of the DHCP scope

newName

string

The new name of the DHCP scope to rename an existing scope

ntpServerDomainNames

list / elements=string

List of NTP server domain names that the DHCP server should automatically resolve

ntpServers

list / elements=string

List of Network Time Protocol (NTP) server IP addresses to be used by the clients

offerDelayTime

integer

The time duration in milliseconds that the DHCP server delays sending an DHCPOFFER message

pingCheckEnabled

boolean

Allow the DHCP server to check if an IP address is already in use to prevent IP address conflicts

Choices:

  • false

  • true

pingCheckRetries

integer

The maximum number of ping requests to try

pingCheckTimeout

integer

The timeout interval in milliseconds to wait for a ping reply

reservedLeases

list / elements=dictionary

List of reserved IP addresses to assign to specific clients

address

string / required

Reserved IP address

comments

string

Comments for this reservation

hardwareAddress

string / required

MAC address of the client

hostName

string

Host name for the reserved lease

routerAddress

string

The default gateway IP address to be used by the clients

serverAddress

string

The IP address of next server (TFTP) to use in bootstrap by the clients

If not specified, the DHCP server’s IP address is used

serverHostName

string

The optional bootstrap server host name to be used by clients to identify the TFTP server

startingAddress

string

The starting IP address of the DHCP scope

Required when creating a new scope

staticRoutes

list / elements=dictionary

List of static routes for clients

destination

string / required

Destination network address

router

string / required

Router/gateway address for this route

subnetMask

string / required

Subnet mask for the destination

subnetMask

string

The subnet mask of the network

Required when creating a new scope

tftpServerAddresses

list / elements=string

List of TFTP Server addresses or VoIP Configuration Server addresses

useThisDnsServer

boolean

Use this DNS server’s IP address to configure the DNS Servers DHCP option for clients

Choices:

  • false

  • true

validate_certs

boolean

Whether to validate SSL certificates when making API requests

Choices:

  • false

  • true ← (default)

vendorInfo

list / elements=dictionary

List of vendor information entries

identifier

string / required

Vendor class identifier

information

string / required

Vendor specific information as colon-separated or normal hex string

winsServers

list / elements=string

List of NBNS/WINS server IP addresses to be used by the clients

See Also

Examples

- name: Create a new DHCP scope
  technitium_dns_set_dhcp_scope:
    api_url: "http://localhost"
    api_token: "myapitoken"
    name: "Office Network"
    startingAddress: "10.0.1.1"
    endingAddress: "10.0.1.254"
    subnetMask: "255.255.255.0"
    routerAddress: "10.0.1.1"
    leaseTimeDays: 7

- name: Update existing scope with DNS settings
  technitium_dns_set_dhcp_scope:
    api_url: "http://localhost"
    api_token: "myapitoken"
    name: "Office Network"
    domainName: "office.local"
    useThisDnsServer: true
    dnsUpdates: true
    dnsTtl: 900

- name: Configure scope with exclusions and reserved leases
  technitium_dns_set_dhcp_scope:
    api_url: "http://localhost"
    api_token: "myapitoken"
    name: "Office Network"
    exclusions:
      - startingAddress: "10.0.1.1"
        endingAddress: "10.0.1.10"
    reservedLeases:
      - hostName: "printer"
        hardwareAddress: "00-11-22-33-44-55"
        address: "10.0.1.100"
        comments: "Office printer"

- name: Rename a scope
  technitium_dns_set_dhcp_scope:
    api_url: "http://localhost"
    api_token: "myapitoken"
    name: "Office Network"
    newName: "Main Office Network"

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

Response data from the API

Returned: always

status

string

API response status

Returned: always

Sample: "ok"

changed

boolean

Whether the module made changes

Returned: always

Sample: true

diff

dictionary

Dictionary showing what changed, with current and desired values

Returned: when changes are made

Sample: {"leaseTimeDays": {"current": 7, "desired": 14}}

failed

boolean

Whether the module failed

Returned: always

Sample: false

msg

string

Human readable message describing the result

Returned: always

Sample: "DHCP scope configuration updated successfully."

Authors

  • Frank Muise (@effectivelywild)