instack-undercloud/scripts/instack-install-undercloud
2014-10-02 20:17:53 -04:00

88 lines
2.9 KiB
Bash
Executable File

#!/bin/bash
set -eu
mkdir -p ~/.instack
LOGFILE=~/.instack/install-undercloud.log
exec > >(tee $LOGFILE)
exec 2>&1
echo "Running $0"
export JSONFILE=${JSONFILE:-/usr/share/instack-undercloud/json-files/fedora-20-undercloud-delorean.json}
export ELEMENTS_PATH=${ELEMENTS_PATH:-"/usr/share/diskimage-builder/elements/ \
/usr/share/tripleo-image-elements/ \
/usr/share/instack-undercloud/"}
echo "Sourcing answers file from instack.answers..."
source ~/instack.answers
export DEPLOYMENT_MODE
export IMAGE_PATH
export LOCAL_IP
export DNSMASQ_START
export DNSMASQ_END
export LOCAL_INTERFACE
export MASQUERADE_NETWORK
export POWER_DRIVER
export VIRTUAL_POWER_USER
export VIRTUAL_POWER_HOST
export DHCP_START
export DHCP_END
export NETWORK_CIDR
export NETWORK_GATEWAY
export UNDERCLOUD_DB_PASSWORD=${UNDERCLOUD_DB_PASSWORD:-$(tripleo os-make-password)}
export UNDERCLOUD_ADMIN_TOKEN=${UNDERCLOUD_ADMIN_TOKEN:-$(tripleo os-make-password)}
export UNDERCLOUD_ADMIN_PASSWORD=${UNDERCLOUD_ADMIN_PASSWORD:-$(tripleo os-make-password)}
export UNDERCLOUD_GLANCE_PASSWORD=${UNDERCLOUD_GLANCE_PASSWORD:-$(tripleo os-make-password)}
export UNDERCLOUD_HEAT_PASSWORD=${UNDERCLOUD_HEAT_PASSWORD:-$(tripleo os-make-password)}
export UNDERCLOUD_NEUTRON_PASSWORD=${UNDERCLOUD_NEUTRON_PASSWORD:-$(tripleo os-make-password)}
export UNDERCLOUD_NOVA_PASSWORD=${UNDERCLOUD_NOVA_PASSWORD:-$(tripleo os-make-password)}
export UNDERCLOUD_IRONIC_PASSWORD=${UNDERCLOUD_IRONIC_PASSWORD:-$(tripleo os-make-password)}
export UNDERCLOUD_TUSKAR_PASSWORD=${UNDERCLOUD_TUSKAR_PASSWORD:-$(tripleo os-make-password)}
export UNDERCLOUD_CEILOMETER_PASSWORD=${UNDERCLOUD_CEILOMETER_PASSWORD:-$(tripleo os-make-password)}
export UNDERCLOUD_CEILOMETER_SNMPD_PASSWORD=${UNDERCLOUD_CEILOMETER_SNMPD_PASSWORD:-$(tripleo os-make-password)}
sudo -E instack \
-p $ELEMENTS_PATH \
-j $JSONFILE
RUN_ORC=${RUN_ORC:-"1"}
if [ "$RUN_ORC" = "1" ]; then
sudo IMAGE_PATH=$IMAGE_PATH os-refresh-config
fi
# generate ssh authentication keys if they don't exist
if [ ! -f ~/.ssh/id_rsa ]; then
ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa
fi
command $(sudo cat /root/stackrc | xargs)
if ! nova keypair-show default 2>&1 1>/dev/null; then
tripleo user-config
fi
export COMPLETION_MESSAGE=${COMPLETION_MESSAGE:-"\
#############################################################################
install-undercloud complete.
The file containing this installation's passwords is at
/root/tripleo-undercloud-passwords.
There is also a stackrc file at /root/stackrc.
These files are needed to interact with the OpenStack services, and should be
secured. For convenience, they can be copied to the current directory:
sudo cp /root/tripleo-undercloud-passwords .
sudo cp /root/stackrc .
#############################################################################"}
echo "$COMPLETION_MESSAGE"