-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·48 lines (37 loc) · 1.38 KB
/
install.sh
File metadata and controls
executable file
·48 lines (37 loc) · 1.38 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
#!/bin/bash
clear
echo ""
echo "Configures an OpenStack multi-node private cloud using DevStack"
echo "Source: https://docs.openstack.org/devstack/latest/guides/multinode-lab.html"
echo ""
echo "Run $0 -h for help"
echo ""
function usage()
{
echo "Usage: $0 [options]"
echo -e "\t-c or --controller installs the OpenStack controller"
echo -e "\t-n or --node Controller-IP installs an OpenStack node that will be managed"
echo -e " by the controller with the given IP address"
echo -e " (run this for every node you want to add to the cluster)"
}
if [[ $# -lt 1 || $1 == "-h" || $1 == "/h" ]]; then
usage
exit 0
fi
if [[ $# -lt 2 && ($1 == "-n" || $1 == "--node") ]]; then
usage
exit 0
fi
apt-get install -y git
USERNAME="stack"
useradd -s /bin/bash -d /opt/$USERNAME -m $USERNAME
cp *.sh /opt/$USERNAME && chmod a+x /opt/$USERNAME/*.sh
#Gives user root permission if it has not been given yet
cat /etc/sudoers | grep "$USERNAME ALL=(ALL) NOPASSWD: ALL" > /dev/null || echo "$USERNAME ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
if [[ $1 == "-c" || $1 == "--controller" ]]; then
sudo -i -u $USERNAME ./openstack-controller.sh
elif [[ $1 == "-n" || $1 == "--node" ]]; then
#SERVICE_HOST = IP of the open stack controller
SERVICE_HOST=$2
sudo -i -u $USERNAME ./openstack-node.sh $SERVICE_HOST
fi