-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprovision-rackspace-cluster.sh
executable file
·47 lines (36 loc) · 1.33 KB
/
provision-rackspace-cluster.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env bash
#
# Usage: ./provision-rackspace-cluster.sh <key pair name> [flavor]
#
set -e
THIS_DIR=$(cd $(dirname $0); pwd) # absolute path
CONTRIB_DIR=$(dirname $THIS_DIR)
source $CONTRIB_DIR/utils.sh
if [ -z "$1" ]; then
echo_red 'Usage: provision-rackspace-cluster.sh <key pair name> [flavor]'
exit 1
fi
if [ -z "$2" ]; then
FLAVOR="performance1-2"
else
FLAVOR=$2
fi
if ! which supernova > /dev/null; then
echo_red 'Please install the dependencies listed in the README and ensure they are in your $PATH.'
exit 1
fi
if ! supernova production network-list|grep -q deis &>/dev/null; then
echo_yellow "Creating deis private network..."
supernova production network-create deis 10.21.12.0/24
fi
NETWORK_ID=`supernova production network-list|grep deis|awk -F"|" '{print $2}'|sed 's/^ *//g'`
if [ -z "$DEIS_NUM_INSTANCES" ]; then
DEIS_NUM_INSTANCES=3
fi
i=1 ; while [[ $i -le $DEIS_NUM_INSTANCES ]] ; do \
echo_yellow "Provisioning deis-$i..."
supernova production boot --image 24614284-19a9-4348-bee3-a504d7094d1b --flavor $FLAVOR --key-name $1 --user-data ../coreos/user-data --no-service-net --nic net-id=$NETWORK_ID --config-drive true deis-$i ; \
((i = i + 1)) ; \
done
echo_green "Your Deis cluster has successfully deployed to Rackspace."
echo_green "Please continue to follow the instructions in the README."