Files
lpic-sim/ai/common/templates/ansible/.env.sh
T
Björn RundenandClaude Opus 5.5 7f6b8ebe07 Basis aus 2nd-brain für LPIC-Prüfungsvorbereitung übernommen
Regeln, Standards, Kontextstruktur und Werkzeuge übernommen; 2nd-brain-
Inhalte (Stacks, Ansible-Inventar, Architektur, Knowledge) entfernt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 21:56:53 +01:00

36 lines
1.7 KiB
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
#-------------------------------------------------------------------------------
## @file .env.sh
## @brief Ansible-Kontext für dieses Repo setzen (Pfade + Secret-Store)
## @author <AUTOR – aus ai/context/responsible.md>
## @owner <VERANTWORTLICH – aus ai/context/responsible.md>
## @version 1.0.0 (07.10.2026)
## @usage source ansible/.env.sh (bash und zsh, aus beliebigem Verzeichnis)
#-------------------------------------------------------------------------------
# Pfad dieser Datei – bash: BASH_SOURCE, zsh: %x
_ANS_SRC="${BASH_SOURCE[0]:-${(%):-%x}}"
_ANS_DIR="$(cd "$(dirname "$_ANS_SRC")" && pwd -P)"
# --- Ansible-Pfade (fremden Kontext zurücksetzen) ---
unset ANSIBLE_CONFIG ANSIBLE_INVENTORY ANSIBLE_ROLES_PATH ANSIBLE_VAULT_PASSWORD_FILE
export ANSIBLE_BASE_PATH="$_ANS_DIR"
export ANSIBLE_CONFIG="$ANSIBLE_BASE_PATH/ansible.cfg"
export ANSIBLE_INVENTORY="$ANSIBLE_BASE_PATH/inv"
export ANSIBLE_ROLES_PATH="$ANSIBLE_BASE_PATH/roles"
export ANS_PLAYDIR="$ANSIBLE_BASE_PATH/playbooks"
export ANS_FILES="$ANSIBLE_BASE_PATH/files"
export ANS_DEFAULT_HOSTS="<STANDARDHOST>" # nur Doku – Default steht im Play
# --- Secret-Store (HashiCorp Vault, bevorzugt) – Token aus ~/.vault-token ---
export VAULT_ADDR="<VAULT_ADDR>"
export ANSIBLE_HASHI_VAULT_ADDR="$VAULT_ADDR"
export ANSIBLE_HASHI_VAULT_AUTH_METHOD="token"
export ANS_VAULT_KV_MOUNT="secret"
export ANS_VAULT_KV_PATH="<projekt>"
# --- Ansible Vault (nur Fallback, Passwortdatei außerhalb des Repos) ---
[ -f "$HOME/.ans-secret-<projekt>" ] && export ANSIBLE_VAULT_PASSWORD_FILE="$HOME/.ans-secret-<projekt>"
unset _ANS_DIR _ANS_SRC
echo "Ansible-Kontext aktiv: ANSIBLE_BASE_PATH=$ANSIBLE_BASE_PATH"