-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate-cluster.sh
74 lines (67 loc) · 1.81 KB
/
create-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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
cd ~
rm --force ./create-cluster.log
exec > >(tee --append ./create-cluster.log)
exec 2>&1
date
echo "Read the options"
TEMP=`getopt -o a:p:t:s:n --long spappid:,sppassword:,sptenantid:,subscription:,nameserviceid: -- "$@"`
eval set -- "$TEMP"
echo "Extract options and their arguments into variables"
while true ; do
case "$1" in
-a|--spappid)
spappid=$2 ; shift 2;;
-p|--sppassword)
sppassword=$2 ; shift 2;;
-t|--sptenantid)
sptenantid=$2 ; shift 2;;
-s|--subscription)
subscription=$2 ; shift 2;;
-n|--nameserviceid)
nameserviceid=$2 ; shift 2;;
--) shift ; break ;;
*) echo "ERROR: Unable to get variables from arguments" ; exit 1 ;;
esac
done
if [ -z "$spappid" ]
then
echo "Missing required argument: -a | spappid"
exit 1
fi
if [ -z "$sppassword" ]
then
echo "Missing required argument: -p | sppassword"
exit 1
fi
if [ -z "$sptenantid" ]
then
echo "Missing required argument: -t | sptenantid"
exit 1
fi
if [ -z "$subscription" ]
then
echo "Missing required argument: -s | subscription"
exit 1
fi
if [ -z "$nameserviceid" ]
then
echo "Missing required argument: -n | nameserviceid"
exit 1
fi
echo "Activate python environment"
source ~/env/bin/activate
echo "Azure CLI"
az login --service-principal --username $spappid --password $sppassword --tenant $sptenantid
az account set --subscription $subscription
echo "Setup agent forwarding"
export ANSIBLE_HOST_KEY_CHECKING=False
export ANSIBLE_LOG_PATH=~/play.log
eval $(ssh-agent -s)
ssh-add ~/.ssh/id_rsa
echo "Run launch script"
cd ~/fluo-muchos/bin
./muchos launch --cluster $nameserviceid
echo "Run setup script"
sed -i "s/zkfc/zkfc,spark/" ~/fluo-muchos/conf/muchos.props
./muchos setup --cluster $nameserviceid