From 00f4ec10076c6023a9cd5f0a545c41c7da7258a5 Mon Sep 17 00:00:00 2001 From: Robert Date: Sun, 4 Oct 2026 01:59:46 -0600 Subject: [PATCH] Add fresh server bootstrap script --- bootstrap.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 bootstrap.sh diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100755 index 0000000..3f64c32 --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +set -e + +REPO_URL="https://gitea.romerozone.top/robert/ansible_pull_master.git" + +echo "=== Ansible Pull Bootstrap ===" +echo + +if [ "$EUID" -ne 0 ]; then + echo "Please run this script with sudo:" + echo " sudo ./bootstrap.sh" + exit 1 +fi + +echo "Installing required packages..." +apt update +apt install -y git ansible + +echo +read -rsp "Enter Ansible Vault password: " VAULT_PASSWORD +echo + +printf '%s\n' "$VAULT_PASSWORD" > /root/.ansible_vault_password +chmod 600 /root/.ansible_vault_password +unset VAULT_PASSWORD + +mkdir -p /etc/ansible + +cat > /etc/ansible/ansible.cfg <<'EOF' +[defaults] +vault_password_file = /root/.ansible_vault_password +EOF + +echo +echo "Running initial Ansible Pull..." +echo + +ansible-pull -U "$REPO_URL" local.yml + +echo +echo "=== Bootstrap complete ==="