machine_setup/ansible/run.bash
2022-10-15 00:54:11 -04:00

28 lines
671 B
Bash
Executable File

#!/usr/bin/env bash
#
# Run ansible
set -euo pipefail
IFS=$'\n\t'
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$DIR"
function die {
code="$1"
shift 1
(>&2 echo "${@}")
exit "$code"
}
target="$1"
shift 1
if [ "$target" = "homeserver" ]; then
ansible-playbook -v -i environments/home playbook.yaml --diff --limit homeserver "${@}"
elif [ "$target" = "odolinux" ]; then
ansible-playbook -v -i environments/laptop playbook.yaml --diff --limit odolinux "${@}"
elif [ "$target" = "odofreebsd" ]; then
ansible-playbook -v -i environments/laptop playbook.yaml --diff --limit odofreebsd "${@}"
else
die 1 "Unrecognized target"
fi