-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevstack_install.sh
More file actions
executable file
·59 lines (43 loc) · 1.73 KB
/
Copy pathdevstack_install.sh
File metadata and controls
executable file
·59 lines (43 loc) · 1.73 KB
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
#!/bin/bash
# Just the basics of setting a cloud image based instance to be ready for devstack
# To Copy & Run:
# curl https://raw.githubusercontent.com/nmagnezi/tools/master/development/devstack_install.sh > devstack_install.sh ; bash devstack_install.sh
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
# Determine which OS
export SERVER_OS=$(awk -F "=" '/^NAME/ {print $2}' /etc/*-release)
if [[ "$SERVER_OS" == '"CentOS Linux"' ]]; then
export USER="centos"
elif [[ "$SERVER_OS" == '"Red Hat Enterprise Linux Server"' ]]; then
export USER="cloud-user"
else
# "Ubuntu"
export USER="ubuntu"
fi
# set locale if logged in from macOS
echo "LANG=en_US.UTF-8" >> /etc/environment
echo "LC_ALL=en_US.UTF-8" >> /etc/environment
# create and set stack user as sudoer
useradd -s /bin/bash -d /opt/stack -m stack
echo "stack ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/stack
# Copy the injected ssh keys to the stack user, for direct SSH access
mkdir /opt/stack/.ssh
cp /home/$USER/.ssh/authorized_keys /opt/stack/.ssh
chown -R stack:stack /opt/stack/.ssh/
chmod 700 /opt/stack/.ssh
chmod 600 /opt/stack/.ssh/authorized_keys
# Make sure you get the latest pip & setuptools (prevent breakage on CentOS)
easy_install pip
pip install --upgrade pip setuptools
# Install git and tools
yum install -y vim git tig wget tmux screen || apt-get install -y vim git wget tmux screen
# Clone my tools
sudo -u stack sudo git clone https://github.com/nmagnezi/tools.git /opt/stack/tools
chown -R stack:stack /opt/stack/tools
sudo -u stack sudo git clone https://git.openstack.org/openstack-dev/devstack /opt/stack/devstack
chown -R stack:stack /opt/stack/devstack
echo ""
echo "Now create your local.conf and stack"
echo ""