-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·64 lines (54 loc) · 1.59 KB
/
setup.sh
File metadata and controls
executable file
·64 lines (54 loc) · 1.59 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
59
60
61
62
63
64
#!/bin/bash
# Set versions for tools
terraform_version="1.4.5"
ansible_version="latest"
sudo apt install wget curl unzip -y
# Check if git is already installed
if command -v pip3 &>/dev/null; then
echo "pip3 is already installed"
else
# Download git
sudo apt-get update
sudo apt-get install python3-pip -y
fi
# Check if git is already installed
if command -v git &>/dev/null; then
echo "Git is already installed"
else
# Download git
sudo apt-get update
sudo apt-get install git -y
fi
# Check if DevStack repo is already cloned
if -f /home/$USER/devstack/stack.sh &>/dev/null; then
echo "DevStack is already cloned"
else
# Clone DevStack
git clone https://github.com/openstack/devstack.git /home/$USER/devstack
fi
read -p "Set DevStack Password: " -sr stackPass
touch /home/$USER/devstack/local.conf
echo """[[local|localrc]]
ADMIN_PASSWORD=$stackPass
DATABASE_PASSWORD=$ADMIN_PASSWORD
RABBIT_PASSWORD=$ADMIN_PASSWORD
SERVICE_PASSWORD=$ADMIN_PASSWORD""" > /home/$USER/devstack/local.conf
# Check if Terraform is already installed
if command -v terraform &>/dev/null; then
echo "Terraform is already installed"
else
# Download Terraform
curl "https://releases.hashicorp.com/terraform/${terraform_version}/terraform_${terraform_version}_linux_amd64.zip" -o "setup/terraform.zip"
unzip setup/terraform.zip -d setup/
sudo mv setup/terraform /usr/local/bin/
fi
# Check if Ansible is already installed
if command -v ansible &>/dev/null; then
echo "Ansible is already installed"
else
# Download Ansible
sudo pip install ansible
fi
# Verify installation
terraform --version
ansible --version