
- Excluding awk and python scripts. - The Bashate E012 rule ('heredoc did not end before EOF') could be simply ignored until the bashate bug will be fixed. Change-Id: Id72665aba83df753364940c82db08edcb11e1217 Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
177 lines
7.3 KiB
Bash
Executable File
177 lines
7.3 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Copyright 2013 Hewlett-Packard Development Company, L.P.
|
|
# All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
set -eu
|
|
|
|
SCRIPT_NAME=$(basename $0)
|
|
SCRIPT_HOME=$(dirname $0)
|
|
|
|
function show_options {
|
|
echo "Usage: $SCRIPT_NAME [options] <controlplane-ip>"
|
|
echo
|
|
echo "Perform initial setup of a cloud running on <controlplane-ip>"
|
|
echo
|
|
echo "This will register ec2, image, orchestration, identity, network, "
|
|
echo "volume (optional), dashboard (optional), metering (optional) and "
|
|
echo "compute services as running on the default ports on controlplane-ip."
|
|
echo
|
|
echo "Options:"
|
|
echo " -r, --region -- Override the default region 'regionOne'."
|
|
echo " --ceilometer-password -- Specify a password for ceilometer"
|
|
echo " --cinder-password -- Specify a password for cinder."
|
|
echo " --glance-password -- Specify a password for glance."
|
|
echo " --heat-password -- Specify a password for heat."
|
|
echo " --ironic-password -- Specify a password for ironic."
|
|
echo " --neutron-password -- Specify a password for neutron."
|
|
echo " --nova-password -- Specify a password for nova."
|
|
echo " --swift-password -- Specify a password for swift"
|
|
echo " --tuskar-password -- Specify a password for tuskar"
|
|
echo " --enable-horizon -- Enable horizon"
|
|
echo " --debug -- Debug the API calls made."
|
|
echo " --ssl -- Use SSL public endpoints. Takes the hostname to"
|
|
echo " use for the public endpoints."
|
|
echo " --public -- Use non-SSL public endpoints. Takes the ip/hostname"
|
|
echo " to use for the public endpoints."
|
|
echo
|
|
echo "For instance: $SCRIPT_NAME 192.0.2.1"
|
|
echo "For instance(ssl): $SCRIPT_NAME --ssl mysite.org 192.0.2.1"
|
|
exit $1
|
|
}
|
|
|
|
DEBUG=""
|
|
CEILOMETER_PASSWORD=""
|
|
CINDER_PASSWORD=""
|
|
GLANCE_PASSWORD=""
|
|
HEAT_PASSWORD=""
|
|
IRONIC_PASSWORD=""
|
|
NEUTRON_PASSWORD=""
|
|
NOVA_PASSWORD=""
|
|
SWIFT_PASSWORD=""
|
|
TUSKAR_PASSWORD=""
|
|
ENABLE_HORIZON=""
|
|
SSL=""
|
|
PUBLIC=""
|
|
REGION="regionOne" #NB: This is the keystone default.
|
|
|
|
TEMP=`getopt -o r: -l region:,debug,ceilometer-password:,cinder-password:,glance-password:,heat-password:,ironic-password:,public:,neutron-password:,nova-password:,swift-password:,tuskar-password:,enable-horizon,ssl: -n $SCRIPT_NAME -- "$@"`
|
|
if [ $? != 0 ]; then
|
|
echo "Terminating..." >&2;
|
|
exit 1;
|
|
fi
|
|
|
|
# Note the quotes around `$TEMP': they are essential!
|
|
eval set -- "$TEMP"
|
|
|
|
while true ; do
|
|
case "$1" in
|
|
-r|--region) export REGION=$2; shift 2 ;;
|
|
--debug) export DEBUG=--debug; set -x; shift 1;;
|
|
--ceilometer-password) export CEILOMETER_PASSWORD=$2; shift 2 ;;
|
|
--cinder-password) export CINDER_PASSWORD=$2; shift 2 ;;
|
|
--glance-password) export GLANCE_PASSWORD=$2; shift 2 ;;
|
|
--heat-password) export HEAT_PASSWORD=$2; shift 2 ;;
|
|
--ironic-password) export IRONIC_PASSWORD=$2; shift 2 ;;
|
|
--neutron-password) export NEUTRON_PASSWORD=$2; shift 2 ;;
|
|
--nova-password) export NOVA_PASSWORD=$2; shift 2 ;;
|
|
--public) export PUBLIC=$2; shift 2 ;;
|
|
--swift-password) export SWIFT_PASSWORD=$2; shift 2 ;;
|
|
--tuskar-password) export TUSKAR_PASSWORD=$2; shift 2 ;;
|
|
--enable-horizon) export ENABLE_HORIZON=--enable-horizon; shift 1;;
|
|
--ssl) export SSL=$2; shift 2 ;;
|
|
-h) show_options 0;;
|
|
--) shift ; break ;;
|
|
*) echo "Error: unsupported option $1." ; exit 1 ;;
|
|
esac
|
|
done
|
|
|
|
HOST=${1:-""}
|
|
EXTRA=${2:-""}
|
|
|
|
if [ -z "$HOST" -o -n "$EXTRA" ]; then
|
|
show_options 1
|
|
fi
|
|
|
|
INTERNAL_HOST=http://${HOST}:
|
|
|
|
if [ -n "$SSL" ]; then
|
|
PUBLIC_HOST=https://${SSL}:
|
|
elif [ -n "$PUBLIC" ]; then
|
|
PUBLIC_HOST=http://${PUBLIC}:
|
|
else
|
|
PUBLIC_HOST=$INTERNAL_HOST
|
|
fi
|
|
|
|
# Skip Heat for now... see heat bug https://launchpad.net/bugs/1235555
|
|
NORMAL_PORT=8004
|
|
SSL_PORT=8004
|
|
PASSWORD=$HEAT_PASSWORD register-endpoint $DEBUG -r $REGION -d "Heat Service" heat orchestration -i ${INTERNAL_HOST}${NORMAL_PORT} ${PUBLIC_HOST}${SSL_PORT}
|
|
|
|
NORMAL_PORT=9696
|
|
SSL_PORT=${SSL:+13696}
|
|
SSL_PORT=${SSL_PORT:-$NORMAL_PORT}
|
|
PASSWORD=$NEUTRON_PASSWORD register-endpoint $DEBUG -r $REGION -d "Neutron Service" neutron network -i ${INTERNAL_HOST}${NORMAL_PORT} ${PUBLIC_HOST}${SSL_PORT}
|
|
|
|
NORMAL_PORT=9292
|
|
SSL_PORT=${SSL:+13292}
|
|
SSL_PORT=${SSL_PORT:-$NORMAL_PORT}
|
|
PASSWORD=$GLANCE_PASSWORD register-endpoint $DEBUG -r $REGION -d "Glance Image Service" glance image -i ${INTERNAL_HOST}${NORMAL_PORT} ${PUBLIC_HOST}${SSL_PORT}
|
|
|
|
NORMAL_PORT=8773
|
|
SSL_PORT=${SSL:+13773}
|
|
SSL_PORT=${SSL_PORT:-$NORMAL_PORT}
|
|
register-endpoint $DEBUG -r $REGION -d "EC2 Compatibility Layer" ec2 ec2 -i ${INTERNAL_HOST}${NORMAL_PORT} ${PUBLIC_HOST}${SSL_PORT}
|
|
|
|
NORMAL_PORT=8774
|
|
SSL_PORT=${SSL:+13774}
|
|
SSL_PORT=${SSL_PORT:-$NORMAL_PORT}
|
|
PASSWORD=$NOVA_PASSWORD register-endpoint $DEBUG -r $REGION -d "Nova Compute Service" nova compute -i ${INTERNAL_HOST}${NORMAL_PORT} ${PUBLIC_HOST}${SSL_PORT}
|
|
PASSWORD=$NOVA_PASSWORD register-endpoint $DEBUG -r $REGION -d "Nova Compute Service v3" nova computev3 -i ${INTERNAL_HOST}${NORMAL_PORT} ${PUBLIC_HOST}${SSL_PORT}
|
|
|
|
if [ -n "$CEILOMETER_PASSWORD" ]; then
|
|
# Updating Ceilometer to be like other services
|
|
NORMAL_PORT=8777
|
|
SSL_PORT=${SSL:+13777}
|
|
SSL_PORT=${SSL_PORT:-$NORMAL_PORT}
|
|
PASSWORD=$CEILOMETER_PASSWORD register-endpoint $DEBUG -r $REGION -d "Ceilometer Service" ceilometer metering -i ${INTERNAL_HOST}${NORMAL_PORT} ${PUBLIC_HOST}${SSL_PORT}
|
|
fi
|
|
if [ -n "$CINDER_PASSWORD" ]; then
|
|
NORMAL_PORT=8776
|
|
SSL_PORT=${SSL:+13776}
|
|
SSL_PORT=${SSL_PORT:-$NORMAL_PORT}
|
|
PASSWORD=$CINDER_PASSWORD register-endpoint $DEBUG -r $REGION -d "Cinder Volume Service" cinder volume -i ${INTERNAL_HOST}${NORMAL_PORT} ${PUBLIC_HOST}${SSL_PORT}
|
|
PASSWORD=$CINDER_PASSWORD register-endpoint $DEBUG -r $REGION -d "Cinder Volume Service V2" cinderv2 volumev2 -i ${INTERNAL_HOST}${NORMAL_PORT} ${PUBLIC_HOST}${SSL_PORT}
|
|
fi
|
|
if [ -n "$SWIFT_PASSWORD" ]; then
|
|
NORMAL_PORT=8080
|
|
SSL_PORT=${SSL:+13080}
|
|
SSL_PORT=${SSL_PORT:-$NORMAL_PORT}
|
|
PASSWORD=$SWIFT_PASSWORD register-endpoint $DEBUG -r $REGION -d "Swift Object Storage Service" swift object-store -i ${INTERNAL_HOST}${NORMAL_PORT} ${PUBLIC_HOST}${SSL_PORT}
|
|
fi
|
|
if [ -n "$ENABLE_HORIZON" ]; then
|
|
# XXX: SSL not wired up yet.
|
|
register-endpoint $DEBUG -r $REGION -d "OpenStack Dashboard" horizon dashboard -i ${INTERNAL_HOST} ${INTERNAL_HOST}
|
|
fi
|
|
if [ -n "$IRONIC_PASSWORD" ]; then
|
|
# XXX: SSL not wired up yet.
|
|
PASSWORD=$IRONIC_PASSWORD register-endpoint $DEBUG -r $REGION -d "Ironic Service" ironic baremetal -i ${INTERNAL_HOST}6385 ${PUBLIC_HOST}6385
|
|
fi
|
|
|
|
if [ -n "$TUSKAR_PASSWORD" ]; then
|
|
# XXX: SSL not wired up yet.
|
|
PASSWORD=$TUSKAR_PASSWORD register-endpoint $DEBUG -r $REGION -d "Tuskar Service" tuskar management -i ${INTERNAL_HOST}8585 ${PUBLIC_HOST}8585
|
|
fi
|