forked from lukeogg/ubuntu-dev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathretrieve-credentials.sh
executable file
·49 lines (29 loc) · 1.08 KB
/
retrieve-credentials.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
#!/bin/bash
#==================================== Default Variables ==========================================#
cert_path=$(cat inventory | grep -Po "(?<==).*\.pem")
# Get Host from inventory file
host=$(cat inventory | grep -Po "(.*)amazonaws\.com")
#==================================== Print Credentials ==========================================#
ssh -T -i $cert_path ubuntu@$host << HEREDOC
echo "
===================== return credentials ========================
"
cd ~/kaptain
export KUBECONFIG=\$(find ~/kaptain -maxdepth 1 -name 'kaptain-*.conf' | awk -F/ '{ print }')
export KAPTAIN_URL=\$(kubectl get svc kaptain-ingress --namespace kaptain-ingress -o jsonpath="{.status.loadBalancer.ingress[*].hostname}")
echo "
Kaptain Credentials
URL: https://\$KAPTAIN_URL
default users: [email protected] and [email protected]
default password: password
"
echo "
Kommander Credentials:"
make kommander-credentials
echo ""
HEREDOC
echo "
SSH connection:
"
echo "ssh -i $(pwd)/$cert_path ubuntu@$host"
exit 0