CLI

The NMPolicy project can be used as a CLI calling the nmstatectl command after installing it.

Installation

To install nmpolicyctl you need the go command at your system and run the following command:

go install github.com/nmstate/nmpolicy

Usage with nmstatectl

Normally the nmpolicyctl command will be execute side by side with the cli from nmstate nmstatectl:

nmstatectl show | nmpolicyctl gen policy.yaml | nmstatectl apply

The nmpolicyctl command will output the generated desired state like the one at the first example.

It will dump by default the captured states to ~/.cache/nmpolicy/cache.yaml

Main Help

This tool helps you to generate dynamic NMState configurations.
The generated NMState configuration is written to STDOUT.

Usage:
  nmpolicyctl [command]

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  gen         Generates NMState by policy filename
  help        Help about any command

Flags:
  -h, --help   help for nmpolicyctl

Use "nmpolicyctl [command] --help" for more information about a command.

Generate State Help

Generates NMState by policy filename

Usage:
  nmpolicyctl gen policy.yaml [flags]

Flags:
  -i, --captured-states-input string    input file path for already resolved captured states.
  -o, --captured-states-output string   output file path to the emitted captured states. (default "/home/runner/.cache/nmpolicy/captured-states.yaml")
  -s, --current-state string            input file path to current NMState. If not specified, STDIN is used.
  -h, --help                            help for gen