unifi apply
About 450 words
Make the site match a set of manifests.
Usage
unifi apply -f <file|directory|-> [flags]Create and update configuration objects so that the site matches the manifests in the given files, directories (.yaml, .yml, .json) or standard input.
Objects are matched by kind and metadata.name. A manifest only states the fields it cares about: fields it does not mention keep their value on the controller. Applying is idempotent, so applying an export of a site changes nothing.
A manifest's metadata.site selects the site; without it the site of the current context (or --site) is used, so one set of files can configure several sites.
--prune also deletes objects that exist on the site but in none of the manifests, for the kinds the manifests contain. Deleting always asks for confirmation unless --yes is given. --dry-run shows the plan and stops; unifi diff does the same with an exit code for scripts.
Manifests reference other objects, such as a network's firewall zone or a WiFi network's network, by their controller ID. Those IDs differ between sites and controllers, so manifests with references are not portable yet: apply refuses, before changing anything, to write a reference to an object the target site does not have.
A manifest with a top-level field that no object of its kind on the site has is refused before anything changes: that is nearly always a typo, and the error suggests the field that was meant. --force sends it anyway.
--output wide also lists the objects that were left unchanged.
Examples
unifi apply -f network.yaml
unifi apply -f site/ --recursive --dry-run
unifi apply -f site/ --recursive --prune
unifi export networks | unifi apply -f - --site "Lake House"
unifi apply -f site/ --yes --output jsonFlags
| Flag | Description |
|---|---|
--dry-run | show what would change without changing it |
-f, --filename <file> | manifest file or directory to read, repeatable; - reads standard input |
--force | send fields that no object of a kind on the site has, instead of refusing them as typos |
--prune | delete objects of the given kinds that no manifest names |
-R, --recursive | also read the subdirectories of a directory |
-y, --yes | do not ask for confirmation |
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 |
