Initial server-infra setup

This commit is contained in:
2026-07-06 15:34:49 -05:00
commit f848420d8f
17 changed files with 605 additions and 0 deletions
+65
View File
@@ -0,0 +1,65 @@
#!/usr/bin/env bash
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$REPO_ROOT"
LIMIT=""
EXTRA_ARGS=()
usage() {
cat <<EOF
Usage: $(basename "$0") [HOST] [OPTIONS]
Provision server(s) with site.yml.
HOST Optional. Limit to one host: adama, roslin, or desktop.
Omit to run against all webservers.
Options:
--check Dry run (ansible --check)
--diff Show diffs
-h, --help Show this help
Examples:
$(basename "$0") adama --check # dry run on adama only
$(basename "$0") adama # provision adama
$(basename "$0") # provision all hosts
EOF
}
while [[ $# -gt 0 ]]; do
case "$1" in
-h|--help)
usage
exit 0
;;
--check)
EXTRA_ARGS+=(--check)
shift
;;
--diff)
EXTRA_ARGS+=(--diff)
shift
;;
adama|roslin|desktop)
LIMIT="$1"
shift
;;
*)
echo "Unknown argument: $1" >&2
usage >&2
exit 1
;;
esac
done
CMD=(ansible-playbook playbooks/site.yml "${EXTRA_ARGS[@]}")
if [[ -n "$LIMIT" ]]; then
CMD+=(--limit "$LIMIT")
echo "==> Targeting host: $LIMIT"
else
echo "==> Targeting all webservers"
fi
exec "${CMD[@]}"