Manifests
About 2582 words
A manifest is one configuration object as a YAML or JSON document. unifi export writes manifests, unifi diff and unifi apply read them, and get --output yaml on any configuration subject prints them. The configuration-as-code guide covers the workflow; this page is the format.
Envelope
apiVersion: network.unifi.specht-labs.de/v1alpha1
kind: Network
metadata:
name: IoT
site: Default
id: 58aa7221-fd83-4c68-afe4-d7f9a7cd00cf
annotations:
owner: cedi
spec:
vlanId: 20
status:
metadata:
origin: USER_DEFINED| Field | Required | Description |
|---|---|---|
apiVersion | yes | Always network.unifi.specht-labs.de/v1alpha1. |
kind | yes | One of the kinds below, matched without regard to case. A plural or a command name is refused with the kind that was meant. |
metadata.name | yes | The object's name. apply matches existing objects by kind and name within the site. |
metadata.site | no | The site the object belongs to, by name, internal reference or ID. Empty means the site of the current context or of --site. |
metadata.id | no | The controller's identifier. Informational; exports leave it out unless --keep-ids is given. When present on apply, it picks the object among several of the same name. |
metadata.annotations | no | Free-form notes as a map of text to text. unifi-cli doesn't interpret them. |
spec | yes | The desired configuration, in the controller's own field names. |
status | no | Fields the controller manages itself, such as an object's origin or a voucher's code. Printed by get --output yaml, left out of exports, ignored by apply. |
The configuration and theme files use a different API group, unifi.specht-labs.de/v1alpha1; they aren't manifests and can't be applied.
spec
spec holds the object as the controller represents it, without the fields the server manages. For kinds of the official API that means camelCase fields as in Ubiquiti's API documentation; for kinds of the internal API it means the controller's snake_case names. unifi-cli doesn't rename or validate individual fields, so the controller is the authority on what a spec may contain, and unifi <subject> describe <name> is the quickest way to see a real one.
A spec may be partial. Fields a manifest doesn't mention keep their value on the controller.
A secret field may hold <redacted>, which apply reads as "keep the value the controller has". A field counts as secret when its name starts with x_ or mentions a passphrase, password, secret, private or pre-shared key, or token. Inside a list, a redacted value is kept for the item the controller already has, matched by what identifies the item, not by its position.
Unknown fields
A top-level field of spec that no object of the kind on the site has is refused by diff and apply before anything changes, with a suggestion for the field that was probably meant. --force accepts such fields.
References
Objects refer to each other by the controller's IDs: network.networkId, zoneId, native_networkconf_id. Those IDs are specific to a site on a controller, and unifi-cli doesn't translate them. A manifest that refers to an object the target site doesn't have is refused when the plan is made. Manifests are therefore not portable across sites or controllers yet, except for kinds without references, such as DNS records, static routes and port forwards.
Files and streams
- A YAML file may hold several documents separated by
---. - A JSON file may hold one manifest or an array of manifests.
-ftakes a file, a directory or-for standard input; directories are read for.yaml,.ymland.jsonfiles, with--recursivefor subdirectories.unifi export --dirwrites<site>/<command>/<name>.yamlwith mode0600: the directory is named after the command that manages the kind (wifi,firewall-policies), and the file after the object's name in lower case with other characters replaced by-.
Kinds
unifi resources get --output wide prints this table from the binary.
| Kind | Plural | Command | API | Path |
|---|---|---|---|---|
Network | networks | unifi networks | official | /integration/v1/sites/{siteId}/networks |
WifiBroadcast | wifi-broadcasts | unifi wifi | official | /integration/v1/sites/{siteId}/wifi/broadcasts |
FirewallZone | firewall-zones | unifi firewall zones | official | /integration/v1/sites/{siteId}/firewall/zones |
FirewallPolicy | firewall-policies | unifi firewall policies | official | /integration/v1/sites/{siteId}/firewall/policies |
ACLRule | acl-rules | unifi acls | official | /integration/v1/sites/{siteId}/acl-rules |
DNSPolicy | dns-policies | unifi dns | official | /integration/v1/sites/{siteId}/dns/policies |
TrafficMatchingList | matching-lists | unifi traffic lists | official | /integration/v1/sites/{siteId}/traffic-matching-lists |
Voucher | vouchers | unifi vouchers | official | /integration/v1/sites/{siteId}/hotspot/vouchers |
FirewallGroup | firewall-groups | unifi firewall groups | internal | /api/s/{site}/rest/firewallgroup |
PortProfile | port-profiles | unifi port-profiles | internal | /api/s/{site}/rest/portconf |
PortForward | port-forwards | unifi port-forwards | internal | /api/s/{site}/rest/portforward |
StaticRoute | static-routes | unifi routes | internal | /api/s/{site}/rest/routing |
Internet | internet-connections | unifi internet | internal | /api/s/{site}/rest/networkconf |
VPNServer | vpn-servers | unifi vpn servers | internal | /api/s/{site}/rest/networkconf |
VPNClient | vpn-clients | unifi vpn clients | internal | /api/s/{site}/rest/networkconf |
SiteToSiteVPN | site-to-site-vpns | unifi vpn site-to-site | internal | /api/s/{site}/rest/networkconf |
RadiusProfile | radius-profiles | unifi radius | internal | /api/s/{site}/rest/radiusprofile |
DynamicDNS | dynamic-dns | unifi ddns | internal | /api/s/{site}/rest/dynamicdns |
TrafficRule | traffic-rules | unifi traffic rules | internal | /v2/api/site/{site}/trafficrules |
TrafficRoute | traffic-routes | unifi traffic routes | internal | /v2/api/site/{site}/trafficroutes |
KnownClient | known-clients | unifi known-clients | internal | /api/s/{site}/rest/user |
Setting | settings | unifi settings | internal | /api/s/{site}/rest/setting |
{siteId} is the site's UUID and {site} its internal reference, both below the Network application's root (/proxy/network on a UniFi OS console).
Kinds marked official are served by the UniFi Network Integration API, which is documented and versioned. Kinds marked internal are served by the API the web interface itself uses. It works with the same API key, but Ubiquiti doesn't document it and changes it between Network versions; treat manifests of those kinds as tied to the Network version they were exported from.
apply creates objects in the order of this table and deletes in the reverse order, so references resolve.
Examples by kind
Every example below is real output of unifi export against the demo controller, one object per kind.
Network
Networks and VLANs. Managed by unifi networks, exported as networks or networks, served by the official Network API at /integration/v1/sites/{siteId}/networks.
apiVersion: network.unifi.specht-labs.de/v1alpha1
kind: Network
metadata:
name: IoT
spec:
cellularBackupEnabled: true
default: false
enabled: true
internetAccessEnabled: true
ipv4Configuration:
autoScaleEnabled: false
dhcpConfiguration:
domainName: iot.home.arpa
ipAddressRange:
start: 192.168.20.100
stop: 192.168.20.254
leaseTimeSeconds: 43200
mode: SERVER
pingConflictDetectionEnabled: true
hostIpAddress: 192.168.20.1
prefixLength: 24
isolationEnabled: true
management: GATEWAY
mdnsForwardingEnabled: false
vlanId: 20
zoneId: 9f659c37-d8d2-4170-adf5-113ff3cc0e10Create networks before the WiFi broadcasts, zones and port profiles that refer to them; unifi apply orders this for you.
WifiBroadcast
WiFi networks (SSIDs). Managed by unifi wifi, exported as wifi or wifi-broadcasts, served by the official Network API at /integration/v1/sites/{siteId}/wifi/broadcasts.
apiVersion: network.unifi.specht-labs.de/v1alpha1
kind: WifiBroadcast
metadata:
name: Nordlicht
spec:
bandSteeringEnabled: true
broadcastingDeviceFilter:
type: ALL
broadcastingFrequenciesGHz:
- 2.4
- 5
- 6
clientIsolationEnabled: false
enabled: true
hideName: false
multicastToUnicastConversionEnabled: true
network:
networkId: 46cdd79f-a1ee-47b6-aad7-4f95e5397567
type: SPECIFIC
securityConfiguration:
fastRoamingEnabled: true
passphrase: <redacted>
pmfMode: REQUIRED
type: WPA3_PERSONAL
type: STANDARD
uapsdEnabled: truenetwork.networkId is the controller's ID of the network. securityConfiguration.passphrase is a secret and reads <redacted>; the personal security modes require one, and apply refuses a new WiFi network without it.
FirewallZone
Firewall zones. Managed by unifi firewall zones, exported as firewall zones or firewall-zones, served by the official Network API at /integration/v1/sites/{siteId}/firewall/zones.
apiVersion: network.unifi.specht-labs.de/v1alpha1
kind: FirewallZone
metadata:
name: IoT
spec:
networkIds:
- 58aa7221-fd83-4c68-afe4-d7f9a7cd00cfnetworkIds lists the controller's IDs of the member networks. The zones the controller defines itself are exported only with --include-system.
FirewallPolicy
Zone-based firewall policies. Managed by unifi firewall policies, exported as firewall policies or firewall-policies, served by the official Network API at /integration/v1/sites/{siteId}/firewall/policies. Objects of the same name are told apart by source.zoneId, destination.zoneId.
apiVersion: network.unifi.specht-labs.de/v1alpha1
kind: FirewallPolicy
metadata:
name: Block IoT to Internal
spec:
action:
allowReturnTraffic: false
type: BLOCK
description: IoT devices never start connections into the trusted networks.
destination:
zoneId: 83fb8986-b5e5-4354-a8c7-745af28fc1b8
enabled: true
ipProtocolScope:
ipVersion: IPV4_AND_IPV6
loggingEnabled: true
reportFlowEnabled: false
source:
zoneId: 9f659c37-d8d2-4170-adf5-113ff3cc0e10Zones are referenced by ID. The controller's built-in policies can't be changed and are exported only with --include-system.
ACLRule
Switch ACL rules. Managed by unifi acls, exported as acls or acl-rules, served by the official Network API at /integration/v1/sites/{siteId}/acl-rules.
apiVersion: network.unifi.specht-labs.de/v1alpha1
kind: ACLRule
metadata:
name: Isolate cameras
spec:
action: BLOCK
description: Cameras may only talk to the NAS.
destinationFilter:
networkIds:
- 58aa7221-fd83-4c68-afe4-d7f9a7cd00cf
type: NETWORKS
enabled: true
protocolFilter:
- TCP
- UDP
sourceFilter:
ipAddressesOrSubnets:
- 192.168.20.31
- 192.168.20.32
- 192.168.20.33
- 192.168.20.35
type: IP_ADDRESSES_OR_SUBNETS
type: IPV4DNSPolicy
Local DNS records and DNS policies. Managed by unifi dns, exported as dns or dns-policies, served by the official Network API at /integration/v1/sites/{siteId}/dns/policies. metadata.name is the domain. Objects of the same name are told apart by type.
apiVersion: network.unifi.specht-labs.de/v1alpha1
kind: DNSPolicy
metadata:
name: photos.home.arpa
spec:
enabled: true
targetDomain: nas.home.arpa
ttlSeconds: 3600
type: CNAME_RECORDThe value field depends on the record type: ipv4Address, ipv6Address, targetDomain and so on.
TrafficMatchingList
Port and IP address lists used by firewall policies. Managed by unifi traffic lists, exported as traffic lists or matching-lists, served by the official Network API at /integration/v1/sites/{siteId}/traffic-matching-lists.
apiVersion: network.unifi.specht-labs.de/v1alpha1
kind: TrafficMatchingList
metadata:
name: Web Ports
spec:
items:
- type: PORT_NUMBER
value: 80
- type: PORT_NUMBER
value: 443
- start: 8080
stop: 8090
type: PORT_NUMBER_RANGE
type: PORTSVoucher
Hotspot vouchers. Managed by unifi vouchers, exported as vouchers or vouchers, served by the official Network API at /integration/v1/sites/{siteId}/hotspot/vouchers.
apiVersion: network.unifi.specht-labs.de/v1alpha1
kind: Voucher
metadata:
name: Babysitter
spec:
authorizedGuestLimit: 1
timeLimitMinutes: 480Vouchers are tickets, not configuration: a full unifi export leaves them out, and unifi export vouchers includes them. The code is assigned by the controller and appears under status in unifi vouchers get --output yaml.
FirewallGroup
Legacy firewall address and port groups. Managed by unifi firewall groups, exported as firewall groups or firewall-groups, served by the internal API at /api/s/{site}/rest/firewallgroup.
apiVersion: network.unifi.specht-labs.de/v1alpha1
kind: FirewallGroup
metadata:
name: Web Ports
spec:
group_members:
- '80'
- '443'
group_type: port-groupPortProfile
Switch port profiles. Managed by unifi port-profiles, exported as port-profiles or port-profiles, served by the internal API at /api/s/{site}/rest/portconf.
apiVersion: network.unifi.specht-labs.de/v1alpha1
kind: PortProfile
metadata:
name: IoT
spec:
autoneg: true
forward: native
isolation: false
lldpmed_enabled: true
native_networkconf_id: c95ad3589154acb95728d54d
op_mode: switch
poe_mode: auto
port_security_enabled: false
stp_port_mode: truePortForward
Port forwarding rules. Managed by unifi port-forwards, exported as port-forwards or port-forwards, served by the internal API at /api/s/{site}/rest/portforward.
apiVersion: network.unifi.specht-labs.de/v1alpha1
kind: PortForward
metadata:
name: HTTPS to reverse proxy
spec:
dst_port: '443'
enabled: true
fwd: 192.168.40.11
fwd_port: '443'
log: false
pfwd_interface: wan
proto: tcp
src: anyStaticRoute
Static routes. Managed by unifi routes, exported as routes or static-routes, served by the internal API at /api/s/{site}/rest/routing.
apiVersion: network.unifi.specht-labs.de/v1alpha1
kind: StaticRoute
metadata:
name: Lab behind Proxmox
spec:
enabled: true
static-route_distance: 1
static-route_network: 10.99.0.0/24
static-route_nexthop: 192.168.40.11
static-route_type: nexthop-route
type: static-routeInternet
Internet (WAN) connections. Managed by unifi internet, exported as internet or internet-connections, served by the internal API at /api/s/{site}/rest/networkconf.
apiVersion: network.unifi.specht-labs.de/v1alpha1
kind: Internet
metadata:
name: LTE Backup
spec:
enabled: true
purpose: wan
wan_dns1: 1.1.1.1
wan_load_balance_type: failover-only
wan_load_balance_weight: 1
wan_networkgroup: WAN2
wan_provider_capabilities:
download_kilobits_per_second: 50000
upload_kilobits_per_second: 10000
wan_smartq_enabled: false
wan_type: dhcp
wan_vlan_enabled: falseA wrong WAN setting takes the site offline. Change these from a local context.
VPNServer
VPN servers (WireGuard, OpenVPN, L2TP). Managed by unifi vpn servers, exported as vpn servers or vpn-servers, served by the internal API at /api/s/{site}/rest/networkconf.
apiVersion: network.unifi.specht-labs.de/v1alpha1
kind: VPNServer
metadata:
name: WireGuard
spec:
dhcpd_dns_1: 192.168.1.1
dhcpd_dns_enabled: true
enabled: true
ip_subnet: 192.168.60.1/24
local_port: 51820
purpose: remote-user-vpn
vpn_type: wireguard-server
wireguard_interface: wan
x_wireguard_private_key: <redacted>Server keys are secrets and read <redacted>.
VPNClient
VPN client tunnels. Managed by unifi vpn clients, exported as vpn clients or vpn-clients, served by the internal API at /api/s/{site}/rest/networkconf.
apiVersion: network.unifi.specht-labs.de/v1alpha1
kind: VPNClient
metadata:
name: Privacy VPN
spec:
enabled: true
ip_subnet: 10.14.0.2/32
purpose: vpn-client
vpn_type: wireguard-client
wireguard_client_mode: file
wireguard_client_peer_ip: 192.0.2.77
wireguard_client_peer_port: 51820SiteToSiteVPN
Site-to-site VPN tunnels. Managed by unifi vpn site-to-site, exported as vpn site-to-site or site-to-site-vpns, served by the internal API at /api/s/{site}/rest/networkconf.
apiVersion: network.unifi.specht-labs.de/v1alpha1
kind: SiteToSiteVPN
metadata:
name: Lake House
spec:
enabled: true
ipsec_dh_group: 14
ipsec_dynamic_routing: false
ipsec_encryption: aes256
ipsec_hash: sha256
ipsec_key_exchange: ikev2
ipsec_local_ip: 203.0.113.42
ipsec_peer_ip: 198.51.100.23
ipsec_pfs: true
ipsec_profile: customized
purpose: site-vpn
remote_vpn_subnets:
- 192.168.50.0/24
vpn_type: ipsec-vpnThe pre-shared key is a secret.
RadiusProfile
RADIUS profiles. Managed by unifi radius, exported as radius or radius-profiles, served by the internal API at /api/s/{site}/rest/radiusprofile.
apiVersion: network.unifi.specht-labs.de/v1alpha1
kind: RadiusProfile
metadata:
name: Default
spec:
acct_servers: []
auth_servers:
- ip: 192.168.1.1
port: 1812
x_secret: <redacted>
interim_update_enabled: false
use_usg_auth_server: true
vlan_enabled: true
vlan_wlan_mode: optionalServer secrets are secrets in the manifest sense too.
DynamicDNS
Dynamic DNS. Managed by unifi ddns, exported as ddns or dynamic-dns, served by the internal API at /api/s/{site}/rest/dynamicdns. metadata.name is the host name.
apiVersion: network.unifi.specht-labs.de/v1alpha1
kind: DynamicDNS
metadata:
name: home.example.net
spec:
interface: wan
login: home.example.net
server: ''
service: cloudflare
x_password: <redacted>TrafficRule
Policy engine traffic rules. Managed by unifi traffic rules, exported as traffic rules or traffic-rules, served by the internal API at /v2/api/site/{site}/trafficrules. metadata.name is the description.
apiVersion: network.unifi.specht-labs.de/v1alpha1
kind: TrafficRule
metadata:
name: Kids bedtime
spec:
action: BLOCK
enabled: false
matching_target: INTERNET
schedule:
mode: EVERY_DAY
time_range_end: 06:30
time_range_start: '21:00'
target_devices:
- client_mac: 02:ec:e3:a2:15:66
type: CLIENTTrafficRoute
Policy engine traffic routes. Managed by unifi traffic routes, exported as traffic routes or traffic-routes, served by the internal API at /v2/api/site/{site}/trafficroutes. metadata.name is the description.
apiVersion: network.unifi.specht-labs.de/v1alpha1
kind: TrafficRoute
metadata:
name: Streaming via Privacy VPN
spec:
domains:
- domain: streaming.example.com
- domain: video.example.org
enabled: true
kill_switch_enabled: true
matching_target: DOMAIN
network_id: 3614f5b47ffd79096b0cde5c
target_devices:
- client_mac: 02:39:83:8e:d4:90
type: CLIENTtarget_devices and the interface are referenced by controller IDs.
KnownClient
Client records: aliases, fixed IPs and notes. Managed by unifi known-clients, exported as known-clients or known-clients, served by the internal API at /api/s/{site}/rest/user. metadata.name is the MAC address.
apiVersion: network.unifi.specht-labs.de/v1alpha1
kind: KnownClient
metadata:
name: 02:df:25:61:cc:b4
spec:
blocked: false
fixed_ip: 192.168.40.10
name: NAS
use_fixedip: trueOne object per client the controller remembers. On a large site this is the bulk of an export; name the kinds you want to leave it out.
Setting
Controller and site settings (management, updates, CyberSecure, high availability, ...). Managed by unifi settings, exported as settings or settings, served by the internal API at /api/s/{site}/rest/setting. metadata.name is the settings key.
apiVersion: network.unifi.specht-labs.de/v1alpha1
kind: Setting
metadata:
name: ntp
spec:
ntp_server_1: ptbtime1.ptb.de
ntp_server_2: pool.ntp.org
ntp_server_3: ''
ntp_server_4: ''
setting_preference: manualSettings always exist, so apply only ever updates them and --prune never deletes one. Keys and fields differ between controller models and Network versions.
