forked from hortonworks/ansible-hortonworks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
set_cloud.sh
executable file
·39 lines (35 loc) · 1.16 KB
/
set_cloud.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
#!/usr/bin/env bash
if [ -z "$CLOUD_TO_USE" ]; then
echo "CLOUD_TO_USE environment variable must be set to one of the following: aws, azure, gce, openstack, static"
exit 1
fi
cloud_to_use=$(echo "$CLOUD_TO_USE" | tr '[:upper:]' '[:lower:]')
case $cloud_to_use in
aws|amazon)
cloud_to_use=aws
message="Cloud to be used is AWS.\nMake sure you've set the AWS authentication variables."
;;
azure|microsoft)
cloud_to_use=azure
message="Cloud to be used is Microsoft Azure.\nMake sure $HOME/.azure/credentials exists and it's correct."
;;
gce|google|gcp)
cloud_to_use=gce
message="Cloud to be used is Google Compute Engine.\nMake sure you've set the GCE authentication variables and JSON credentials file."
;;
openstack)
message="Cloud to be used is OpenStack.\nMake sure you've sourced the OpenStack RC file."
;;
static)
message="The static inventory will be used."
;;
terraform)
message="The terraform inventory will be used."
;;
*)
message="CLOUD_TO_USE environment variable was set to \"$CLOUD_TO_USE\" but must be set to one of the following: aws, azure, gce, openstack, static, terraform"
echo -e $message
exit 1
;;
esac
echo -e "${message}"