unifi export
About 526 words
Dump the site's configuration as manifests.
Usage
unifi export [kind...] [flags]Dump the configuration of the site as manifests, ready for version control and for unifi apply. Without arguments every kind is exported; name kinds to export only those (see unifi resources get).
By default the manifests go to standard output as a YAML stream led by a comment that names the site and the controller version; --output json prints a JSON array instead. --file writes one file, --dir a tree of <site>/<kind>/<name>.yaml with one object per file and a stable order, so a re-export shows up as a clean diff. --dir never deletes files; export into an empty directory for an exact mirror.
Kinds are named by their command (wifi, firewall policies), their manifest kind (WifiBroadcast) or their plural (wifi-broadcasts).
Manifests omit the controller's object IDs and, for a single site, the site name. They still refer to other objects, such as a network's firewall zone, by controller ID, so an export applies to the site it came from and is not portable to another site or controller yet. Objects that share a name and cannot be told apart otherwise keep their ID. --keep-ids keeps all IDs, --all-sites exports every site and records each object's site in metadata.site.
What is not your configuration is left out: objects the system defines and does not let you change (--include-system keeps them) and hotspot vouchers (name the kind to export them: unifi export vouchers).
Secrets such as WiFi passphrases, RADIUS secrets and VPN keys are written as <redacted>, which unifi apply reads as "keep the value the controller has"; such an export restores everything but the secrets. --show-secrets writes the real values: they then sit in your terminal or file in plain text. Files are written readable only by you; keep them out of public repositories.
Examples
unifi export
unifi export networks wifi-broadcasts --output json
unifi export --file site.yaml
unifi export --dir config/ --all-sites
unifi export wifi "firewall policies" --skip-unavailable
unifi export | unifi diff -f -Flags
| Flag | Description |
|---|---|
--all-sites | export every site of the controller |
--dir <directory> | write one file per object below this directory |
--file <file> | write the manifests to this file instead of standard output |
--include-system | also export objects the system defines and nobody can change |
--keep-ids | keep the controller's object IDs in metadata.id |
--show-secrets | write secrets in plain text instead of <redacted>; they end up in your terminal or file |
--skip-unavailable | skip kinds the controller cannot list instead of failing |
Global flags
These flags are accepted by every command.
| Flag | Description |
|---|---|
--color-scheme <string> | color scheme: auto, dark or light |
--context <string> | context to use instead of the current one |
--no-cache | ask the controller for everything instead of using cached answers |
-o, --output <string> | output format: text, wide, json, yaml (table is another name for text) |
-s, --site <string> | site to act on instead of the context's default site |
--theme <string> | theme to render with instead of the configured one |
