2024-04-09 11:42:03 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
if [ ! "$BASH_VERSION" ] ; then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "
|
|
|
|
==============================
|
|
|
|
|
2024-05-05 15:44:06 +00:00
|
|
|
MPP - Infra
|
2024-04-09 11:42:03 +00:00
|
|
|
Install Script
|
|
|
|
|
|
|
|
------------------------------
|
|
|
|
"
|
|
|
|
|
|
|
|
stop () {
|
|
|
|
|
|
|
|
echo "
|
|
|
|
==============================
|
|
|
|
"
|
|
|
|
|
|
|
|
exit 1
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
mkdir -p ~/.ssh &> /dev/null
|
|
|
|
|
2024-05-05 16:05:57 +00:00
|
|
|
apt-get update &> /dev/null
|
2024-04-09 11:42:03 +00:00
|
|
|
apt-get install -y python3-pip python3-venv jq git curl &> /dev/null
|
|
|
|
python3 -m venv /opt/ansible &> /dev/null
|
|
|
|
/opt/ansible/bin/pip3 install ansible hvac netaddr jmespath pexpect &> /dev/null
|
|
|
|
|
|
|
|
/opt/ansible/bin/ansible-galaxy collection install -r requirements.yml --upgrade &> /dev/null
|
|
|
|
|
2024-05-05 15:44:06 +00:00
|
|
|
mkdir -p ~/.ansible &> /dev/null
|
2024-04-09 11:42:03 +00:00
|
|
|
|
2024-05-05 15:44:06 +00:00
|
|
|
if [[ ! -f ~/.ansible/vault.yml ]]
|
|
|
|
then
|
|
|
|
echo -n "Vault Password: "
|
|
|
|
read PASSWORD
|
|
|
|
echo "$PASSWORD" > ~/.ansible/vault.yml
|
|
|
|
fi
|
|
|
|
|
|
|
|
ssh-keyscan github.com 1> ~/.ssh/known_hosts 2> /dev/null
|
|
|
|
|
2024-05-05 16:17:04 +00:00
|
|
|
/opt/ansible/bin/ansible-pull -U ssh://git@github.com/MatteZ02/mpp-infra --accept-host-key --private-key ~/.ssh/id_rsa --vault-password-file ~/.ansible/vault.yml tasks.yml -t installer
|
2024-04-09 11:42:03 +00:00
|
|
|
|
|
|
|
echo "
|
|
|
|
==============================
|
2024-04-16 18:00:07 +00:00
|
|
|
"
|