instack-undercloud/scripts/instack-create-overcloudrc
Ben Nemec 14ae8c355f Factor out overcloudrc logic so it can be used standalone
instack-test-overcloud has a bunch of logic for generating an
appropriate overcloudrc environment, but it's tricky to replicate
this manually.  Factor out those pieces into their own script that
generates a standalone overcloudrc file to make it easier to work
with the overcloud.  The standalone rc file is created so they
won't have to first source stackrc every time they want to work
with the overcloud.

Documentation of the new script is also added.

Change-Id: I3b8c99e9e013c27b21bd9a60b5a772dc3b5c1dd6
2015-03-16 16:05:54 -05:00

35 lines
907 B
Bash
Executable File

#!/bin/bash
set -eu
set -o pipefail
OS_AUTH_URL=${OS_AUTH_URL:-""}
if [ -z "$OS_AUTH_URL" ]; then
echo "You must source a stackrc file for the Undercloud."
exit 1
fi
export TRIPLEO_ROOT=${TRIPLEO_ROOT:-"/etc/tripleo"}
export NODES_JSON=${NODES_JSON:-"instackenv.json"}
export TE_DATAFILE=$NODES_JSON
echo "Sourcing answers file from instack.answers..."
source ~/instack.answers
source tripleo-overcloud-passwords
export OVERCLOUD_IP=$(nova list | grep controller0.*ctlplane | sed -e "s/.*=\\([0-9.]*\\).*/\1/")
source $TRIPLEO_ROOT/overcloudrc
cat > ~/overcloudrc << EOF
export NOVA_VERSION=$NOVA_VERSION
export COMPUTE_API_VERSION=$COMPUTE_API_VERSION
export OS_PASSWORD=$OS_PASSWORD
export OS_AUTH_URL=$OS_AUTH_URL
export OS_USERNAME=$OS_USERNAME
export OS_TENANT_NAME=$OS_TENANT_NAME
export OS_NO_CACHE=True
export OS_CLOUDNAME=overcloud
export no_proxy=${no_proxy:-''},$OVERCLOUD_IP
EOF