Juju provides the ability to interact with our cluster without knowing the host IP addresses beforehand. One of the units of the
rabbitiq-server charm that’s been deployed is designated as the “leader”.
juju exec --unit <application>/leader syntax enables commands to be executed on the host itself. The connection information is resolved by Juju.
Remove the guest user account
RabbitMQ comes with a default user account with the username
guest and the password
guest. In production environments, this account should be removed. This can be done via the
rabbitmqctl delete_user command.
$ juju exec --unit rabbitmq/leader 'rabbitmqctl delete_user guest'
Add other user accounts
To add a new user account to RabbitMQ, use the
rabbitmqctl add_user command. Below we use it to add a user account called
$ export RABBIT_PASSWORD=$(head -c20 /dev/urandom | hex)
$ juju exec --unit rabbitmq/leader "rabbitmqctl add_user demo $RABBIT_PASSWORD"
To add any user tags, provide them to the
rabbitmqctl set_user_tags command:
$ juju exec --unit rabbitmq/leader "rabbitmqctl set_user_tags demo administrator"