Skip to content

provision_homelab_service

Stand up a homelab service: DHCP lease + firewall allow + (optional) port forwards.

Side effects:

  • Step 1: creates a static DHCP reservation pinning mac to ip on the named network.
  • Step 2 (when ports is non-empty): creates a LAN_LOCAL accept firewall rule for ip on the requested TCP ports.
  • Step 3 (when wan_expose=True and ports is non-empty): creates one port-forward rule per port, exposing the service to the WAN.
  • Mutates controller state. Use dry_run=True to preview the change without applying.
  • Rollback: if any sub-step fails, all prior sub-steps are reverted in reverse order (port_forwards → firewall_rule → lease) and the response includes rolled_back and partial keys.
provision_homelab_service(name="plex", mac="aa:bb:cc:00:00:01", ip="10.50.0.10", network_id="65f...", ports=[32400], wan_expose=False)
Parameter Type Required Default Description
name string yes Display name (used for both the lease and the firewall rule, e.g. "plex").
mac string yes Client MAC address (e.g. "aa:bb:cc:00:00:01").
ip string yes IPv4 address to reserve (must fall inside the network’s subnet).
network_id string yes _id of the network/VLAN this service lives on.
ports `array null` no null
wan_expose boolean no false True also creates port-forward rules so the service is reachable from the WAN. Default False (LAN-only).
controller string no “default” Name of the UniFi controller to target. Defaults to "default".
dry_run boolean no false Preview the change without applying it. Returns the predicted change set.