#!/bin/bash # --- Lenverge Provisioning Script --- # This script simplifies running the Ansible playbook, making it accessible # for users who are not familiar with Ansible. # Find the script's own directory to run from the correct location, # ensuring that playbook.yml and other files are found. chmod +x /home/$(whoami) SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) cd "$SCRIPT_DIR" echo "▶️ Starting Lenverge Provisioning..." echo " This will install/update services based on your Lenverge.yaml configuration." echo " You will be prompted for your sudo password to make system changes." echo "" # Execute the Ansible playbook. # The `if` statement checks the command's exit code to provide a clear success/failure message. if ansible-playbook playbook.yml -i inventory --ask-become-pass; then echo "" echo "✅ Success! Your Lenverge environment has been provisioned." echo " Don't forget to update your hosts file if you added or changed site domains." echo "" else echo "" echo "❌ Error: Lenverge provisioning failed." >&2 echo " Please review the Ansible output above to diagnose the issue." >&2 exit 1 fi