rocky-docker-lxc/, caddy-vm/, monitoring-vm/ (was missing entirely -
Grafana+Loki+Prometheus stack, refreshed and CA mount stripped same as
everything else), and automation/{ansible,automation-vm,iac}/ for the
three repos that live on the automation VM. Hawser is genuinely
deployed on all three of caddy-vm/monitoring-vm/automation-vm so it's
duplicated in each rather than picking one canonical home.
Old Ansible/ and "Infrastrucutre as Code/" content moved under
automation/ansible/old-playbooks and automation/iac/old-content as-is
for now - contents still need refreshing against the current repos and
a per-folder README, that's the next pass.
28 lines
687 B
Bash
Executable File
28 lines
687 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
VAULT_FILE=".vault_pass.txt"
|
|
VARS_FILE="terraform.pkrvar.hcl"
|
|
PACKER_TEMPLATE="packer.pkr.hcl"
|
|
|
|
# Check if vault password file exists
|
|
if [[ ! -f "$VAULT_FILE" ]]; then
|
|
echo "❌ Vault password file '$VAULT_FILE' not found."
|
|
exit 1
|
|
fi
|
|
|
|
# Decrypt the vars file temporarily
|
|
echo "🔓 Decrypting $VARS_FILE..."
|
|
ansible-vault decrypt "$VARS_FILE" --vault-password-file "$VAULT_FILE"
|
|
|
|
# Run packer build
|
|
echo "🏗️ Running Packer build..."
|
|
packer build -var-file="$VARS_FILE" "$PACKER_TEMPLATE"
|
|
|
|
# Re-encrypt the vars file
|
|
echo "🔒 Re-encrypting $VARS_FILE..."
|
|
ansible-vault encrypt "$VARS_FILE" --vault-password-file "$VAULT_FILE"
|
|
|
|
echo "✅ Done!"
|