24 lines
648 B
Bash
Executable file
24 lines
648 B
Bash
Executable file
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
echo "Starting Ansible CI/CD run..."
|
|
|
|
# --- 2. Navigate to the Ansible directory ---
|
|
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
|
|
ANSIBLE_DIR="${SCRIPT_DIR}/../ansible"
|
|
|
|
if [[ ! -d "${ANSIBLE_DIR}" ]]; then
|
|
echo "Error: Ansible directory not found at ${ANSIBLE_DIR}"
|
|
exit 1
|
|
fi
|
|
|
|
cd "${ANSIBLE_DIR}"
|
|
echo "Changed directory to: $(pwd)"
|
|
|
|
ansible-playbook upload-template.yml \
|
|
--inventory inventory/hosts.yml \
|
|
-e "version=${IMAGE_VERSION:-v0.0.0}" # \
|
|
# --diff \
|
|
# --check false # Set to true for a dry run, false for actual execution
|
|
|
|
echo "Ansible playbook execution finished."
|