2021-12-14 11:20:38 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
TARGET_PLAY="${1:-workstation}"
|
|
|
|
PLAYBOOK="playbooks/${TARGET_PLAY}.yml"
|
|
|
|
|
|
|
|
if [ ! -f $PLAYBOOK ]; then
|
|
|
|
echo "Invalid play '${TARGET_PLAY}'. Unable to locate ${PLAYBOOK}"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
function print_fail_and_exit() {
|
|
|
|
echo "❌ Something went wrong..."
|
|
|
|
cp /tmp/artifacts/${TARGET_PLAY}*.xml ./report.xml
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "======> Running ${TARGET_PLAY}"
|
|
|
|
|
2022-01-18 09:19:19 +00:00
|
|
|
./install-ansible-modules.sh
|
2021-12-14 11:20:38 +00:00
|
|
|
|
|
|
|
# Run Playbook
|
2021-12-18 14:30:00 +00:00
|
|
|
ANSIBLE_CONFIG=$(pwd)/ansible.cfg JUNIT_OUTPUT_DIR="/tmp/artifacts" ansible-playbook ${PLAYBOOK} || print_fail_and_exit
|
2021-12-14 11:20:38 +00:00
|
|
|
|
|
|
|
echo "======> Done."
|