#!/bin/bash # Exit immediately if anything goes wrong, instead of making things worse. set -e source $REPO_ROOT/bootstrap/shared/shared_functions.sh setglobal REQUIRED_VARS = ''( BOOTSTRAP_CHEF_ENV REPO_ROOT ) check_for_envvars $(REQUIRED_VARS[@]) cd $REPO_ROOT/bootstrap/vagrant_scripts setglobal KNIFE = '/opt/opscode/embedded/bin/knife' # Dump the data bag contents to a variable. setglobal DATA_BAG = $[vagrant ssh vm-bootstrap -c "$KNIFE data bag show configs $BOOTSTRAP_CHEF_ENV -F yaml] # Get the management VIP. setglobal MANAGEMENT_VIP = $[vagrant ssh vm-bootstrap -c "$KNIFE environment show $BOOTSTRAP_CHEF_ENV -a override_attributes.bcpc.management.vip | tail -n +2 | awk '{ print \$2 }'] # this is highly naive for obvious reasons (will break on multi-line keys, spaces) # but is sufficient for the items to be extracted here proc extract_value { echo $DATA_BAG | grep "$1:" | awk '{ print $2 }' | tr -d '\r\n' } # Parse certain data bag variables into environment variables for pretty printing. setglobal ROOT_PASSWORD = $[extract_value 'cobbler-root-password] setglobal MYSQL_ROOT_PASSWORD = $[extract_value 'mysql-root-password] setglobal RABBITMQ_USER = $[extract_value 'rabbitmq-user] setglobal RABBITMQ_PASSWORD = $[extract_value 'rabbitmq-password] setglobal HAPROXY_USER = $[extract_value 'haproxy-stats-user] setglobal HAPROXY_PASSWORD = $[extract_value 'haproxy-stats-password] setglobal KEYSTONE_ADMIN_USER = $[extract_value 'keystone-admin-user] setglobal KEYSTONE_ADMIN_PASSWORD = $[extract_value 'keystone-admin-password] # Print everything out for the user. echo "------------------------------------------------------------" echo "Everything looks like it's been installed successfully!" echo echo "Access the BCPC landing page at https://$MANAGEMENT_VIP" echo "Use these users and passwords to access the different resources:" echo echo "Horizon: $KEYSTONE_ADMIN_USER / $KEYSTONE_ADMIN_PASSWORD" echo "HAProxy: $HAPROXY_USER / $HAPROXY_PASSWORD" echo "RabbitMQ: $RABBITMQ_USER / $RABBITMQ_PASSWORD" echo echo "Here are a few additional passwords:" echo "System root password: $ROOT_PASSWORD" echo "MySQL root password: $MYSQL_ROOT_PASSWORD" echo echo "Thanks for using BCPC!"