Newer
Older
#!/bin/bash
echo $0 started at $(date)
PARTICIPANT=${1}
. ./common-vars
. ./main_credentials.rc
VM_NAME=`expr charmedosm-${PARTICIPANT}`
echo "Creating public port"
# This port gets created as the admin
openstack port create --disable-port-security --enable --network $NETWORK $VM_NAME
wait
echo "Creating Keypair"
openstack keypair create --public-key ./hackfest_rsa.pub ${KEY_NAME} &
wait
echo "Launching OSM VM"
openstack server create --key-name ${KEY_NAME} --flavor ${FLAVOR} --image ${FOCAL} --nic port-id=$VM_NAME --user-data ./osm-cloud-init.yaml $VM_NAME &
wait
echo "Waiting for OSM VM to be ready"
IP=`openstack server list --name $VM_NAME --column Networks -f yaml | head -3 | tail -1 | grep -o '[0-9]\+[.][0-9]\+[.][0-9]\+[.][0-9]\+'`
while [ 1 ] ; do
sleep 5
ALIVE=$(ssh -T -o ConnectTimeout=1 -o StrictHostKeyChecking=no -i hackfest_rsa ubuntu@${IP} 'cloud-init status --wait | tail -1' 2> /dev/null)
if [ "${ALIVE}" == "status: done" ] ; then break ; fi
done
echo $0 $@ complete at $(date)