mattez02-infra/init.sh

53 lines
1.1 KiB
Bash
Raw Normal View History

2024-06-18 18:34:48 +00:00
#!/bin/bash
if [ ! "$BASH_VERSION" ] ; then
exit 1
fi
echo "
==============================
MatteZ02 - Infra
Install Script
------------------------------
"
stop () {
echo "
==============================
"
exit 1
}
2024-12-16 12:21:20 +00:00
mkdir -p ~/.ssh/keys/matte &> /dev/null
if [[ ! -f ~/.ssh/keys/matte/infra ]]
then
ssh-keygen -f ~/.ssh/keys/matte/infra -t ed25519 -N '' &> /dev/null
fi
python3 -m venv ~/.venv/ansible &> /dev/null
~/.venv/ansible/bin/pip3 install cryptography dnspython hvac jmespath netaddr pexpect &> /dev/null
~/.venv/ansible/bin/pip3 install ansible &> /dev/null
2024-06-18 18:34:48 +00:00
2024-12-16 12:21:20 +00:00
~/.venv/ansible/bin/ansible-galaxy collection install ansible.posix containers.podman --upgrade &> /dev/null
2024-06-18 18:34:48 +00:00
mkdir -p ~/.ansible &> /dev/null
2024-12-16 12:21:20 +00:00
if [[ ! -f ~/.ansible/vault/matte.yml ]]
2024-06-18 18:34:48 +00:00
then
echo -n "Vault Password: "
read PASSWORD
2024-12-16 12:21:20 +00:00
echo "$PASSWORD" > ~/.ansible/vault/matte.yml
2024-06-18 18:34:48 +00:00
fi
2024-12-16 12:21:20 +00:00
~/.venv/ansible/bin/ansible-pull -U ssh://git@github.com/MatteZ02/infra -d ~/.ansible/pull/matte/infra --accept-host-key --private-key ~/.ssh/keys/matte/infra --vault-password-file ~/.ansible/vault/matte.yml tasks.yml -t installer
2024-06-18 18:34:48 +00:00
echo "
==============================
"