Unifi Dhcp Reservation
Declarative DHCP fixed-IP reservations on a local UniFi controller (UDM / UDM Pro / UDM SE). sync reads every reservation the controller holds; drift compares a desired set against it without writing, reporting missing, mismatched, unmanaged, duplicate and DHCP-pool-overlapping entries; apply reconciles the controller to the desired set and supports dryRun. device_drift does the same read-only comparison for adopted hardware, which cannot hold reservations at all and is addressed through device config instead — the one surface drift is blind to. Reservations live on the legacy Network API as user objects carrying use_fixedip/fixed_ip. Adds TOTP/MFA login support, which the upstream @mgreten/unifi auth flow lacks — UniFi SSO accounts with MFA reject password-only logins with MFA_AUTH_REQUIRED. Catches the failure mode where a reservation silently never takes effect because its address is already claimed by a statically-configured host.
Global Arguments
| Argument | Type | Description |
|---|---|---|
| host | string | UDM IP address or hostname, e.g. 192.0.2.1 |
| username | string | UniFi admin username |
| password | string | UniFi admin password (use a vault reference) |
| totpSecret? | string | Base32 TOTP secret for MFA-enabled accounts (use a vault reference). |
| site | string | UniFi site name |
| Argument | Type | Description |
|---|---|---|
| desired | array | The reservation set that should exist. |
| Argument | Type | Description |
|---|---|---|
| macs? | array | Only these MACs (any separator style). |
| ips? | array | Only these addresses. |
| unreservedOnly | boolean | Only hosts without a fixed-IP reservation. |
| Argument | Type | Description |
|---|---|---|
| desired | array | The reservation set that should exist. |
| Argument | Type | Description |
|---|---|---|
| start | string | First address of the new DHCP range. |
| stop | string | Last address of the new DHCP range. |
| dryRun | boolean | Report what the change would displace without writing. |
| Argument | Type | Description |
|---|---|---|
| devices | array | The devices to pin. |
| netmask | string | |
| gateway | string | Default gateway for the fabric. |
| dns1? | string | |
| dns2? | string | |
| dryRun | boolean |
| Argument | Type | Description |
|---|---|---|
| desired | array | The reservation set that should exist. |
| dryRun | boolean | Report the actions that would be taken without writing. |
Resources
- Has README or module doc2/2earned
- README has a code example1/1earned
- README is substantive1/1earned
- Most symbols documented1/1earned
- No slow types (deprecated)1/1earned
- Dependencies pass trust audit2/2earned
- Has description1/1earned
- Platform support declared (or universal)2/2earned
- License declared1/1earned
- Verified public repository2/2earned