32 lines
651 B
Bash
32 lines
651 B
Bash
#!/bin/bash
|
|
|
|
# Install packages
|
|
sudo apt -y install wget unzip python3 python3-venv
|
|
|
|
# Download terraform
|
|
if [ -d "./bin" ]
|
|
then
|
|
echo "Found bin directory."
|
|
else
|
|
wget https://releases.hashicorp.com/terraform/1.1.3/terraform_1.1.3_linux_amd64.zip
|
|
unzip terraform_1.1.3_linux_amd64.zip -d ./bin
|
|
rm terraform_1.1.3_linux_amd64.zip
|
|
fi
|
|
|
|
# Initialize terraform
|
|
bin/terraform -chdir=terraform_pl init
|
|
|
|
# Create ansible venv for python
|
|
VENV_NAME="./venv"
|
|
|
|
if [ -d "$VENV_NAME" ]
|
|
then
|
|
echo "Found venv directory."
|
|
else
|
|
echo "Creating venv..."
|
|
python3 -m venv "$VENV_NAME"
|
|
source "$VENV_NAME/bin/activate"
|
|
pip3 install ansible
|
|
deactivate
|
|
fi
|