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.

34 lines
700 B

2 years ago
#!/usr/bin/bash
SUDO="sudo"
WORKDIR="/tmp/ansible_setup"
2 years ago
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
2 years ago
${SUDO} apt install -y ansible unzip wget || fail "Failed to install ansible!"
2 years ago
fi
useradd -m nige
groupadd admin
usermod -a -G admin nige
cd /tmp
wget https://git.gerstner.se/nils/ansible_setup/archive/main.zip
unzip main.zip
2 years ago
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