Command 'juju run'

Usage:

juju run [options] <unit> [<unit> ...] <action-name> [<key>=<value> [<key>[.<key> ...]=<value>]]

Summary:

Run an action on a specified unit.

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

--background  (= false)

Run the task in the background

--color  (= false)

Use ANSI color codes in output

--format  (= plain)

Specify output format (json|plain|yaml)

-m, --model (= "")

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

--no-color  (= false)

Disable ANSI color codes in output

-o, --output (= "")

Specify an output file

--params  (= )

Path to yaml-formatted params file

--string-args  (= false)

Use raw string values of CLI args

--utc  (= false)

Show times in UTC

--wait  (= 0s)

Maximum wait time for a task to complete

Details:

Run a charm action for execution on the given unit(s), with a given set of params. An ID is returned for use with juju show-operation <ID>.

A action executed on a given unit becomes a task with an ID that can be used with juju show-task <ID>.

Running an action returns the overall operation ID as well as the individual task ID(s) for each unit.

To queue a action to be run in the background without waiting for it to finish, use the --background option.

To set the maximum time to wait for a action to complete, use the --wait option.

By default, the output of a single action will just be that action’s stdout. For multiple actions, each action stdout is printed with the action id. To see more detailed information about run timings etc, use --format yaml.

Valid unit identifiers are:

  • a standard unit ID, such as mysql/0 or;
  • leader syntax of the form /leader, such as mysql/leader.

If the leader syntax is used, the leader unit for the application will be resolved before the action is enqueued.

Params are validated according to the charm for the unit’s application. The valid params can be seen using “juju actions --schema”. Params may be in a yaml file which is passed with the --params option, or they may be specified by a key.key.key…=value format (see examples below.)

Params given in the CLI invocation will be parsed as YAML unless the --string-args option is set. This can be helpful for values such as ‘y’, which is a boolean true in YAML.

If --params is passed, along with key.key…=value explicit arguments, the explicit arguments will override the parameter file.

Examples:

juju run mysql/3 backup --background
juju run mysql/3 backup --wait=2m
juju run mysql/3 backup --format yaml
juju run mysql/3 backup --utc
juju run mysql/3 backup
juju run mysql/leader backup
juju show-operation <ID>
juju run mysql/3 backup --params parameters.yml
juju run mysql/3 backup out=out.tar.bz2 file.kind=xz file.quality=high
juju run mysql/3 backup --params p.yml file.kind=xz file.quality=high
juju run sleeper/0 pause time=1000
juju run sleeper/0 pause --string-args time=1000

See also:

operations
show-operation
show-task

Last updated 3 months ago.