Lucky Leader

Interact with the Juju leader system.

Usage

leader [FLAGS] <SUBCOMMAND>

Subcommands

  • get: Get data from the leader unit
  • set: Set values as the leader charm
  • is-leader: Get whether or not this unit is the leader unit

Usage

The lucky leader command provides a way to interract with Juju's leader system. You can get, set, and check whether or not the current user is-leader.

The leader unit, elected by Juju, is allowed to set key-value pair using lucky leader set and all of the units in the app are able to read key-value pairs from the leader by using lucky leader get. See the Juju documentation for more information on how to use leadership in Juju.

Examples

Set a random password if the unit is the leader:

if [ "$(lucky leader is-leader)" = "true" ]; then
    lucky leader set password=$(lucky random)
fi

Get the password from the leader unit:

$ lucky leader get password

Set multiple leader values:

$ lucky leader set \
    user=username \
    password=topsecret