04a2399a2c
I'm always curious how long these jobs take, and although the date is being output at the start and finish of the job, the start date usually scrolls out of my terminal buffer before it finishes so it's not possible to check later.
66 lines
2.3 KiB
Bash
Executable File
66 lines
2.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Edit these to match your environment
|
|
AUTH_URL=http://11.1.1.78:5000/v2.0
|
|
USER=admin
|
|
PASSWORD=password
|
|
TENANT=admin
|
|
BMC_IMAGE=centos7-base
|
|
KEY_NAME=bnemec
|
|
UNDERCLOUD_IMAGE=centos7-base
|
|
UNDERCLOUD_FLAVOR=m1.large
|
|
BAREMETAL_FLAVOR=baremetal-6
|
|
|
|
set -ex
|
|
|
|
date
|
|
start_seconds=$(date +%s)
|
|
|
|
BIN_DIR=$(cd $(dirname $0); pwd -P)
|
|
MY_ID=$1
|
|
|
|
BMC_PREFIX=bmc-$MY_ID
|
|
BAREMETAL_PREFIX=baremetal-$MY_ID
|
|
UNDERCLOUD_NAME=undercloud-$MY_ID
|
|
PUBLIC_NET=public-$MY_ID
|
|
PROVISION_NET=provision-$MY_ID
|
|
|
|
# NOTE(bnemec): I'm intentionally not adding a trap to clean this up because
|
|
# if something fails it may be helpful to look at the contents of the tempdir.
|
|
TEMPDIR=$(mktemp -d)
|
|
echo "Working in $TEMPDIR"
|
|
cd $TEMPDIR
|
|
|
|
cp -r $BIN_DIR/../templates .
|
|
cp templates/env.yaml.example ./env.yaml
|
|
sed -i "s|os_auth_url: .*|os_auth_url: $AUTH_URL|" env.yaml
|
|
sed -i "s|os_user: .*|os_user: $USER|" env.yaml
|
|
sed -i "s|os_password: .*|os_password: $PASSWORD|" env.yaml
|
|
sed -i "s|os_tenant: .*|os_tenant: $TENANT|" env.yaml
|
|
sed -i "s/bmc_image: .*/bmc_image: $BMC_IMAGE/" env.yaml
|
|
sed -i "s/key_name: .*/key_name: $KEY_NAME/" env.yaml
|
|
sed -i "s/baremetal_flavor: .*/baremetal_flavor: $BAREMETAL_FLAVOR/" env.yaml
|
|
sed -i "s/undercloud_image: .*/undercloud_image: $UNDERCLOUD_IMAGE/" env.yaml
|
|
sed -i "s/undercloud_flavor: .*/undercloud_flavor: $UNDERCLOUD_FLAVOR/" env.yaml
|
|
echo 'resource_registry:' >> env.yaml
|
|
echo ' OS::OVB::UndercloudFloating: templates/undercloud-floating.yaml' >> env.yaml
|
|
|
|
cp -r $BIN_DIR ./bin
|
|
STACK_NAME=ovb-test
|
|
$BIN_DIR/deploy.py --quintupleo --id $MY_ID --name $STACK_NAME
|
|
sleep 60
|
|
UNDERCLOUD_IP=$(heat output-show $STACK_NAME-$MY_ID undercloud_host_floating_ip | sed -e 's/"//g')
|
|
#bin/build-nodes-json --env env.yaml #--bmc_prefix $BMC_PREFIX --baremetal_prefix $BAREMETAL_PREFIX --provision_net $PROVISION_NET_NAME
|
|
bin/build-nodes-json --bmc_prefix $BMC_PREFIX --baremetal_prefix $BAREMETAL_PREFIX --provision_net $PROVISION_NET
|
|
SSH_OPTS="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
|
|
scp $SSH_OPTS bin/ovb-instack centos@$UNDERCLOUD_IP:/tmp
|
|
scp $SSH_OPTS nodes.json centos@$UNDERCLOUD_IP:~/instackenv.json
|
|
ssh -t -t $SSH_OPTS centos@$UNDERCLOUD_IP /tmp/ovb-instack
|
|
heat stack-delete $STACK_NAME-$MY_ID
|
|
|
|
date
|
|
end_seconds=$(date +%s)
|
|
elapsed_seconds=$(($end_seconds - $start_seconds))
|
|
echo "Finished in $elapsed_seconds seconds"
|
|
rm -rf $TEMPDIR
|