#!/bin/bash
#
# Ansible Collection Boilerplate:
# "a": ansible(1) wrapper script.
#

set -eu -o pipefail

# Change working directory to the base directory ...
cd "$(dirname "$0")/.." || exit 1

# Enable the Python "virtual environment" when one exists:
if [[ -r .venv/bin/activate ]]; then
	# shellcheck disable=SC1091
	. .venv/bin/activate
fi

# Options ...
options=("$@")

[[ -r .ansible-vault-secret ]] && options+=("--vault-password-file=.ansible-vault-secret")

# Run ansible(1):
set -x
exec ansible "${options[@]}"
