added new secret logic for vms

This commit is contained in:
Ubuntu
2026-01-09 13:48:41 +00:00
parent 9182782387
commit 120deabb4d
10 changed files with 182 additions and 70 deletions

View File

@@ -7,9 +7,36 @@ VAULT_CA_LOCAL="./vault-ca.crt"
# Check if bootstrap vars exist
if [ ! -f "$BOOTSTRAP_VARS" ]; then
echo "Fehler: $BOOTSTRAP_VARS nicht gefunden."
echo "Bitte stelle sicher, dass du im Root des Repos bist und die Datei existiert."
exit 1
echo "⚠️ Warnung: $BOOTSTRAP_VARS nicht gefunden."
read -p "Soll eine neue leere Bootstrap-Datei erstellt werden? (y/n) " -n 1 -r
echo ""
if [[ $REPLY =~ ^[Yy]$ ]]; then
cat > "$BOOTSTRAP_VARS" << EOF
# terraform/bootstrap.tfvars
use_vault = false
# Proxmox Credentials
proxmox_api_url = "https://10.100.0.2:8006/api2/json"
proxmox_api_token_id = "root@pam!terraform"
proxmox_api_token_secret = "CHANGE_ME"
# OPNsense Credentials
opnsense_uri = "https://10.100.0.1:4443"
opnsense_api_key = "CHANGE_ME"
opnsense_api_secret = "CHANGE_ME"
# VM User Config
ci_user = "ansible"
ci_password = "InitialPassword123!"
ssh_public_key = "ssh-ed25519 CHANGE_ME"
EOF
echo "✅ Datei erstellt. Bitte editiere '$BOOTSTRAP_VARS' und trage deine Secrets ein."
echo "Führe das Skript danach erneut aus."
exit 0
else
echo "Abbruch."
exit 1
fi
fi
# Check for Vault CA