Hook

Unit environment variables

These variables are available to charms during hook execution.

JUJU_ACTION_NAME

The name of the currently executing action

JUJU_ACTION_NAME=backup

JUJU_ACTION_TAG

A concatenation of JUJU_ACTION_UUID and the word ‘action’.

JUJU_ACTION_TAG=action-97db750c-c7d7-47a4-8b57-9cc3e85f8153

JUJU_ACTION_UUID

The current UUID of the executing action.

JUJU_ACTION_UUID=97db750c-c7d7-47a4-8b57-9cc3e85f8153

JUJU_API_ADDRESSES

A space-separated list of API servers.

JUJU_API_ADDRESSES=10.10.10.1:17070

JUJU_AGENT_SOCKET

The socket that the unit agent uses to communicate with individual Units.

JUJU_AGENT_SOCKET=@/var/lib/juju/agents/unit-postgresql-0/agent.socket

JUJU_AVAILABILITY_ZONE

The availability zone for the unit being executed.

JUJU_CHARM_DIR

The path to the currently executing charm directory.

JUJU_CHARM_DIR=/var/lib/juju/agents/unit-postgresql-0/charm

JUJU_CONTEXT_ID

Used by Juju to communicate to ask a running agent to execute a command on Juju’s behalf.

JUJU_CONTEXT_ID=postgresql/0:db-relation-joined:34317605475203611

JUJU_DEBUG

The temporary directory where juju debug-hooks is spawned from.

JUJU_DEBUG=/tmp/tmp.vGQlc2bTcV

JUJU_MODEL_NAME

The human-friendly name of the current model.

JUJU_MODEL_NAME=default

JUJU_MODEL_UUID

The unique identifier of the juju model.

JUJU_MODEL_UUID=2c0896ce-fd6c-4647-8540-26f848e061f9

JUJU_HOOK_NAME

The name of the hook being executed.

JUJU_HOOK_NAME=db-relation-joined

JUJU_MACHINE_ID

The ID of the machine that’s currently executing the hook.

JUJU_MACHINE_ID=1

JUJU_RELATION

The relation name being executed.

JUJU_RELATION=db

JUJU_RELATION_ID

The ID of the relation being executed.

JUJU_RELATION_ID=db:20

JUJU_REMOTE_UNIT

The name of the current related unit.

JUJU_REMOTE_UNIT=reddit/0

JUJU_UNIT_NAME

The name of the local unit being executed.

JUJU_UNIT_NAME=vanilla/0

JUJU_VERSION

The version of the Juju unit agent.

JUJU_VERSION=2.4.1

JUJU_TARGET_SERIES

The Ubuntu series currently being upgraded to. This is only set where executing a pre-series-upgrade hook.

JUJU_TARGET_SERIES=focal