forked from lukeogg/ubuntu-dev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.sh
executable file
·56 lines (37 loc) · 1.1 KB
/
main.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
#!/bin/bash
. config-vars.sh
terraform init
eval $(maws li "$MAWS_ACCOUNT")
terraform apply -var owner="$AWS_OWNER"
all_arguments=$@
retrieve_credentials=false
echo '========== Local setup... =============='
./local-setup.sh
for i in $@
do
if [ "$i" == 'deploy-kommander' ]; then
echo '========== Deploying Kommander... =========='
./deploy-komdr.sh
retrieve_credentials=true
fi
done
for i in $@
do
if [ "$i" == 'install-kaptain' ]; then
echo '========== Deploying Kommander... =========='
./deploy-komdr.sh
echo '========== Installing Kaptain... ==========='
./install-kapt.sh
retrieve_credentials=true
fi
done
# output ssh connection command
cert_path=$(cat inventory | grep -Po "(?<==).*\.pem")
host=$(cat inventory | grep -Po "(.*)amazonaws\.com")
echo "========== SSH command =========="
echo "ssh -i $(pwd)/$cert_path -t ubuntu@$host"
# output kommander and kaptain credentials
if [ "$retrieve_credentials" == true ]; then
echo '========== Retrieving credentials =========='
./retrieve-credentials.sh
fi