-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathenv.backup
executable file
·53 lines (43 loc) · 1.07 KB
/
env.backup
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
#!/bin/bash
#bdereims@vmware.com
DNSMASQ=/etc/dnsmasq.conf
HOSTS=/etc/hosts
WHERE=$( ip addr show eth1 | grep inet | head -1 | awk '{print $2}' )
WHERE_OVH=$( ip addr show eth0 | grep inet | head -1 | awk '{print $2}' )
if [ "${WHERE_OVH}" == "172.17.111.170/16" ]; then
WHERE="172.17.111.169/16"
fi
WHERE_MAD=$( ip addr show eth0 | grep inet | head -1 | awk '{print $2}' )
ADDRIP=$( ip addr show eth0 | grep inet | head -1 | awk '{print $2}' | sed 's/\/.*$//' )
export ADDRIP
case $WHERE in
"172.16.100.50/22")
ALL_CLUSTER=(dell)
;;
"172.16.100.20/22")
ALL_CLUSTER=(intel)
;;
"164.132.217.50/28")
ALL_CLUSTER=(ovh)
;;
"10.1.1.253/24")
ALL_CLUSTER=(techdata)
;;
esac
case $WHERE_MAD in
"10.10.35.30/24")
ALL_CLUSTER=(mad)
;;
esac
#for CLUSTER in ${ALL_CLUSTER[@]}; do
# RESULT=$( ./extra/check_datastore.sh ${CLUSTER} )
# if [ "${RESULT}" == "Ok!" ]; then
# break
# fi
#done
ENV=$CLUSTER
if [[ ! ${CLUSTER} ]]; then
ENV=${ALL_CLUSTER[0]}
fi
ENV=${ALL_CLUSTER[0]}
source env-${ENV}