Add Juju 3 support to the openrc file used in the Getting Started tutorial. A few other minor improvements. Change-Id: I74315e5a64902d7e96e3557cb99d89493e62ad4c Signed-off-by: Peter Matulis <peter.matulis@canonical.com>
51 lines
1.5 KiB
Plaintext
51 lines
1.5 KiB
Plaintext
# Navigate Juju 2.9/3.x
|
|
JUJU_VERSION=$(juju version | cut -c 1)
|
|
|
|
if [ $JUJU_VERSION -eq 2 ]; then
|
|
RUN="run"
|
|
else
|
|
RUN="exec"
|
|
fi
|
|
|
|
# Place the cloud's CA certificate in a file readable by the openstackclients snap
|
|
_snap_user_dir=~/snap/openstackclients/common
|
|
if [ ! -d $_snap_user_dir ]; then
|
|
mkdir $_snap_user_dir
|
|
fi
|
|
_root_ca=$_snap_user_dir/root-ca.crt
|
|
juju ${RUN} -u vault/leader -- 'leader-get root-ca' | tee $_root_ca >/dev/null 2>&1
|
|
|
|
# Find an IP address for Keystone
|
|
_keystone_vip=$(juju config keystone vip)
|
|
if [ -n "$_keystone_vip" ]; then
|
|
_keystone_ip=$(echo $_keystone_vip | awk '{print $1}')
|
|
else
|
|
_keystone_ip=$(juju ${RUN} -u keystone/leader -- 'network-get --bind-address public')
|
|
fi
|
|
|
|
# Query for the Keystone admin password
|
|
_password=$(juju ${RUN} -u keystone/leader -- 'leader-get admin_passwd')
|
|
|
|
# Unset possible undercloud environment variables
|
|
unset "${!OS_*}"
|
|
|
|
# Set the OpenStack environment variables
|
|
export OS_AUTH_PROTOCOL=https
|
|
export OS_CACERT=${_root_ca}
|
|
export OS_AUTH_URL=${OS_AUTH_PROTOCOL:-http}://${_keystone_ip}:5000/v3
|
|
export OS_USERNAME=admin
|
|
export OS_PASSWORD=${_password}
|
|
export OS_USER_DOMAIN_NAME=admin_domain
|
|
export OS_PROJECT_DOMAIN_NAME=admin_domain
|
|
export OS_PROJECT_NAME=admin
|
|
export OS_REGION_NAME=RegionOne
|
|
export OS_IDENTITY_API_VERSION=3
|
|
# Swift needs this
|
|
export OS_AUTH_VERSION=3
|
|
# Gnocchi needs this
|
|
export OS_AUTH_TYPE=password
|
|
|
|
echo "To print the values to screen (including the admin password):"
|
|
echo
|
|
echo " env | grep OS_"
|