Command 'juju config'


juju config [options] <application name> [--branch <branch-name>] [--reset <key[,key]>] [<attribute-key>][=<value>] ...]


Gets, sets, or resets configuration for a deployed application.

Global Options:

--debug  (= false)

Equivalent to --show-log --logging-config==DEBUG

-h, --help  (= false)

Show help on a command or other topic.

--logging-config (= "")

Specify log levels for modules

--quiet  (= false)

Show no informational output

--show-log  (= false)

If set, write the log file to stderr

--verbose  (= false)

Show more verbose output

Command Options:

-B, --no-browser-login  (= false)

Do not use web browser for authentication

--color  (= false)

Use ANSI color codes in output

--file  (= )

Path to yaml-formatted configuration file

--format  (= yaml)

Specify output format (json|yaml)

-m, --model (= "")

Model to operate in. Accepts [<controller name>:]<model name>|<model UUID>

--no-color  (= false)

Disable ANSI color codes in tabular output

-o, --output (= "")

Specify an output file

--reset  (= )

Reset the provided comma delimited keys


To view all configuration values for an application, run

 juju config <app>

By default, the config will be printed in yaml format. You can instead print it in json format using the --format flag:

juju config <app> --format json

To view the value of a single config key, run

juju config <app> key

To set config values, run

juju config <app> key1=val1 key2=val2 ...

This sets “key1” to “val1”, etc. Using the @ directive, you can set a config key’s value to the contents of a file:

juju config <app> key=@/tmp/configvalue

You can also reset config keys to their default values:

juju config <app> --reset key1
juju config <app> --reset key1,key2,key3

You may simultaneously set some keys and reset others: juju config key1=val1 key2=val2 --reset key3,key4

Config values can be imported from a yaml file using the --file flag:

juju config <app> --file=path/to/cfg.yaml

The yaml file should be in the following format:

apache2:                        # application name
  servername: ""     # key1: val1
  lb_balancer_timeout: 60       # key2: val2

This allows you to e.g. save an app’s config to a file:

juju config app1 > cfg.yaml

and then import the config later. You can also read from stdin using “-”, which allows you to pipe config values from one app to another:

juju config app1 | juju config app2 --file -

You can simultaneously read config from a yaml file and set/reset config keys as above. The command-line args will override any values specified in the file.

By default, any configuration changes will be applied to the currently active branch. A specific branch can be targeted using the --branch option. Changes can be immediately be applied to the model by specifying --branch=master. For example:

juju config apache2 --branch=master
juju config apache2 --branch test-branch

Rather than specifying each setting name/value inline, the --file flag option may be used to provide a list of settings to be updated as a yaml file. The yaml file contents must include a single top-level key with the application’s name followed by a dictionary of key/value pairs that correspond to the names and values of the settings to be set. For instance, to configure apache2, the following yaml file can be used:

  servername: ""
  lb_balancer_timeout: 60

If the above yaml document is stored in a file called config.yaml, the following command can be used to apply the config changes:

juju config apache2 --file config.yaml

Finally, the --reset flag can be used to revert one or more configuration settings back to their default value as defined in the charm metadata:

juju config apache2 --reset servername
juju config apache2 --reset servername,lb_balancer_timeout

See also:


Last updated 1 year, 1 month ago.