This repository has been archived by the owner on Jul 31, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
040-deploy-openstack.sh
executable file
·59 lines (54 loc) · 1.96 KB
/
040-deploy-openstack.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
#!/bin/bash
(( EUID )) && echo You need to be root. && exit 1
set -ex
# compare kernel version using float and string; return 0 when greather or equal
isge () {
lestr=$(echo $(printf "$1\n$2" | sort -V) | awk '{print $1}')
if [[ $1 == $2 ]]; then
return 0
elif [[ $1 == $lestr ]]; then
return 1
else
return 0
fi
}
EXIP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $7}')
EXGW=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $3}')
EXNIC=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $5}')
FSID=$(uuidgen)
KVER=$(uname -r | egrep '^[0-9]*\.[0-9]*' -o | head -n 1)
if isge $KVER 4.5; then
CRUSH_TUNABLES=jewel
elif isge $KVER 4.1; then
CRUSH_TUNABLES=hammer
elif isge $KVER 3.15; then
CRUSH_TUNABLES=firefly
elif isge $KVER 3.9; then
CRUSH_TUNABLES=bobtail
elif isge $KVER 3.6; then
CRUSH_TUNABLES=argonaut
else
CRUSH_TUNABLES=default
fi
OS_DISTRO=$(cat /etc/os-release | grep "PRETTY_NAME" | sed 's/PRETTY_NAME=//g' | sed 's/["]//g' | awk '{print $1}')
if [ $OS_DISTRO == Red ]; then
MASK=$(ifconfig $EXNIC | awk '/netmask /{ print $4;}')
CIDR=$(ipcalc -n $EXIP $MASK | cut -d'=' -f2)/$(ipcalc -p $EXIP $MASK | cut -d'=' -f2)
elif [ $OS_DISTRO == CentOS ]; then
MASK=$(ifconfig $EXNIC | awk '/netmask /{ print $4;}')
CIDR=$(ipcalc -n $EXIP $MASK | cut -d'=' -f2)/$(ipcalc -p $EXIP $MASK | cut -d'=' -f2)
elif [ $OS_DISTRO == Ubuntu ]; then
CIDR=$(ipcalc -n $EXIP $EXGW | awk /'Network:'/'{print $2}')
fi
ARMADA_MANIFEST_DIR=~/apps/armada-manifests
if [ -d $ARMADA_MANIFEST_DIR ]; then
rm -rf $ARMADA_MANIFEST_DIR
fi
cd ~/apps
git clone https://github.com/sktelecom-oslab/armada-manifests.git
armada apply ~/apps/armada-manifests/taco-aio-manifest.yaml \
--set chart:ceph:values.conf.ceph.global.fsid=$FSID \
--set chart:ceph:values.conf.pool.crush.tunables=$CRUSH_TUNABLES \
--set chart:ceph:values.network.public=$CIDR \
--set chart:ceph:values.network.cluster=$CIDR \
--set chart:neutron:values.network.interface.tunnel=$EXNIC