prole/etc/init_ansible.sh
chrisfu da2f6600ba feat: infrastructure and installer updates for k3s, OpenTofu, and prole-db
- Add k3s start/stop Ansible playbooks and roles.

- Implement OpenTofu initialization scripts and k8s manifests.

- Update ncurses installer with OpenTofu support and improved k3s integration.

- Add mode support (--mode) to etc/ initialization scripts.

- Update prole-db with recovery, barman objectstore, and SSH OpenBao support.

- Refine k8s manifests for OpenBao and prole-db.
2026-02-05 21:27:18 -08:00

48 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# init_ansible.sh
# Purpose:
# - Initialize or update the Ansible vault password file (.vault_pass)
# - Should be run after init_openbao.sh
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck disable=SC1090
source "$SCRIPT_DIR/prole_cfg.sh"
if [[ "${1:-}" == "--mode" || "${1:-}" == "-m" ]]; then
prole_set_mode "${2:-}"
shift 2
elif [[ "${1:-}" == --mode=* || "${1:-}" == -m=* ]]; then
prole_set_mode "${1#*=}"
shift
fi
PROLE_ROOT=$(cd "$SCRIPT_DIR/.." && pwd)
VAULT_PASS_FILE="$PROLE_ROOT/.vault_pass"
ACTION=${1:-initialize}
case "$ACTION" in
initialize|update)
# Use PROLE_PASSWD if set, otherwise prompt
if [[ -n "${PROLE_PASSWD:-}" ]]; then
echo "Using PROLE_PASSWD for Ansible Vault password."
echo "$PROLE_PASSWD" > "$VAULT_PASS_FILE"
else
echo -n "Enter Ansible Vault password: "
read -rs vault_pass
echo
echo "$vault_pass" > "$VAULT_PASS_FILE"
fi
chmod 600 "$VAULT_PASS_FILE"
echo "Ansible Vault password file $ACTION""d at $VAULT_PASS_FILE"
;;
*)
echo "Usage: $0 {initialize|update}" >&2
exit 2
;;
esac