You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
637 B
30 lines
637 B
#!/usr/bin/bash
|
|
SUDO="sudo"
|
|
WORKDIR="/tmp/ansible_setup"
|
|
|
|
if [ "$(whoami)" == "root" ]; then
|
|
SUDO=""
|
|
fi
|
|
|
|
fail() {
|
|
>&2 echo "ERROR: ${1}"
|
|
>&2 echo "EXIT 1"
|
|
exit 1
|
|
}
|
|
|
|
if ! which ansible-playbook; then
|
|
${SUDO} apt update
|
|
${SUDO} apt install -y ansible wget || fail "Failed to install ansible!"
|
|
fi
|
|
|
|
cd /tmp
|
|
wget https://git.gerstner.se/nils/ansible_setup/archive/main.zip
|
|
unzip main.zip
|
|
|
|
cd ${WORKDIR} || fail "Could not change to work directory!"
|
|
ansible-playbook local.yml || fail "Failed to execute ansible playbook"
|
|
# ansible-playbook all.yml || fail "Failed to execute ansible playbook"
|
|
|
|
echo "ALL DONE"
|
|
exit 0
|