diff options
Diffstat (limited to 'tools/keystone/endpoint.sh')
-rwxr-xr-x | tools/keystone/endpoint.sh | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tools/keystone/endpoint.sh b/tools/keystone/endpoint.sh new file mode 100755 index 0000000..410a723 --- /dev/null +++ b/tools/keystone/endpoint.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# +# Author: Dimitri Mazmanov (dimitri.mazmanov@ericsson.com) +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +# + +set -o xtrace +set -o errexit +set -o nounset +set -o pipefail + +# Ensure that openrc containing OpenStack environment variables is present. +source openrc + +# Endpoints. Dynamically get IP addresses from another service (keystone) +ENDPOINT_PUBLIC_URL=$(openstack endpoint list | grep keystone | grep public | cut -d '|' -f 8 | cut -d '/' -f 3 | cut -d ':' -f 1) +ENDPOINT_ADMIN_URL=$(openstack endpoint list | grep keystone | grep admin | cut -d '|' -f 8 | cut -d '/' -f 3 | cut -d ':' -f 1) +ENDPOINT_INTERNAL_URL=$(openstack endpoint list | grep keystone | grep internal | cut -d '|' -f 8 | cut -d '/' -f 3 | cut -d ':' -f 1) + +cat <<EOT >> /root/endpoints.ini +[DEFAULT] +public_url=${ENDPOINT_PUBLIC_URL} +admin_url=${ENDPOINT_ADMIN_URL} +private_url=${ENDPOINT_INTERNAL_URL} +os_region=${OS_REGION} +EOT |