Files
Watari-Ansible/gitpull.sh
2026-03-02 07:38:20 +00:00

22 lines
766 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# ------------------------------------------------------------
# firstrun.sh – One‑shot VM bootstrap script.
#
# Run this via a systemd unit on first boot. The script will:
# • Check /apps/firstrun (marker file) to skip if already ran
# • Clone a repo into /apps/$HOSTNAME
# • Execute an Ansible playbook that installs Docker
# • Restore data from /data if it is empty/missing
# • Create a systemd service that runs docker‑compose
# • Log everything to /apps/firstrun.log
# • Optionally send a Discord webhook (placeholder)
#
# ------------------------------------------------------------
set -euo pipefail
APP_DIR="/apps/"
cd $APP_DIR
GIT_SSH_COMMAND="ssh -i ~/.ssh/github_ro" git pull
bash ./firstsetup.sh