-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·118 lines (95 loc) · 3.56 KB
/
run.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
set -euox pipefail
flag=false
while getopts 's' opt; do
case $opt in
s) flag=true ;;
*) echo 'Error in command line parsing' >&2
exit 1 ;;
esac
done
echo "$flag"
if ! "$flag"; then
if [ -f /etc/os-release ]; then
# freedesktop.org and systemd
. /etc/os-release
OS=$NAME
VER=$VERSION_ID
elif type lsb_release >/dev/null 2>&1; then
# linuxbase.org
OS=$(lsb_release -si)
VER=$(lsb_release -sr)
elif [ -f /etc/lsb-release ]; then
# For some versions of Debian/Ubuntu without lsb_release command
. /etc/lsb-release
OS=$DISTRIB_ID
VER=$DISTRIB_RELEASE
elif [ -f /etc/debian_version ]; then
# Older Debian/Ubuntu/etc.
OS=Debian
VER=$(cat /etc/debian_version)
elif [ -f /etc/SuSe-release ]; then
# Older SuSE/etc.
...
elif [ -f /etc/redhat-release ]; then
# Older Red Hat, CentOS, etc.
...
else
# Fall back to uname, e.g. "Linux <version>", also works for BSD, etc.
OS=$(uname -s)
VER=$(uname -r)
fi
echo "INSTALLING DEPENDENCIES"
echo "-----------------------"
if [[ $OS == *"Ubuntu"* ]]; then
sudo dpkg --purge docker docker-engine docker.io containerd runc
sudo apt-get update
sudo apt-get install -y \
ca-certificates \
curl \
gnupg \
lsb-release
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --yes --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo apt-get install -y python3 python3-pip
elif [[ $OS == *"CentOS"* ]]; then
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
sudo yum install -y yum-utils
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo yum -y install python3 python3-pip
else
echo "Distro not supported, please manually install ansible and docker, then run 'ansible-playbook setup.yml'"
fi
export PATH="$HOME/.local/bin:$HOME/bin:$PATH"
pip3 install ansible #openstacksdk
echo "ENSURE MTU FOR DOCKER BRIDGE MATCHES HOST"
echo "-----------------------"
sudo systemctl restart docker
MTU=$(ip -4 r show default | awk '$5 {print $5}' | xargs -n1 ip a show dev | grep mtu | awk '$3 {print $5}' | head -n1)
sudo touch /etc/docker/daemon.json
sudo tee "/etc/docker/daemon.json" > /dev/null <<EOF
{
"mtu":$MTU
}
EOF
sudo systemctl restart docker
fi
git submodule init && git submodule update
pushd tempest-fork/ && git checkout no_admin_creds && git pull && popd
pushd python-tempestconf/ && git checkout master && git pull && popd
pushd HealthMonitorTempestPlugin/ && git checkout main && git pull && popd
ansible-playbook setup.yml --ask-vault-pass