Skip to content
Snippets Groups Projects
Verified Commit d135fde6 authored by Tóth Miklós Tibor's avatar Tóth Miklós Tibor :shrug:
Browse files

bash go brrr

parent 4fe69858
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env bash
reporaw="https://git.sch.bme.hu/kszk/sysadmin/ansible/ansci/-/raw/master/playbook-template"
download() {
local url="$1"
local dest="$2"
if command -v wget &>/dev/null
then
wget "$url" -O "$dest"
else
curl "$url" -O "$dest"
fi
}
downloadFile() {
download "$reporaw/$1" "$1"
}
update() {
# TODO: versioning with tags
if $NOUPDATE
then
return 0
fi
local prevhash
prevhash="$(md5hash "$0")"
download "$reporaw/bootstrap.sh" "$0"
local newhash
newhash="$(md5hash "$0")"
if [[ "$prevhash" != "$newhash" ]]
then
exec bash "$0"
fi
}
update
downloadFile "requirements.python.txt"
downloadFile "requirements.galaxy.yml"
if ! command -v virtualenv &>/dev/null
then
echo "This command needs virtualenv to run."
echo "Install it like this:"
printf "\tpip3 install --user virtualenv\n"
printf "\texport PATH=\"~/.local/bin:\$PATH\"\n"
exit 1
fi
if [[ ! -d .venv ]]
then
virtualenv .venv
fi
source .venv/bin/activate
pip install -r requirements.python.txt
ansible-galaxy install -r requirements.galaxy.yml
ansible-playbook -i inventory.yaml playbook.yml
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment