mirror of
https://gitlab.com/sagidayan/linux-config.git
synced 2024-12-23 06:29:53 +00:00
27 lines
655 B
Bash
27 lines
655 B
Bash
|
#!/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}"
|
||
|
|
||
|
# Install Dependencies
|
||
|
ansible-galaxy collection install community.general
|
||
|
ansible-galaxy install hurricanehrndz.rustup
|
||
|
|
||
|
# Run Playbook
|
||
|
ANSIBLE_CONFIG=$(pwd)/ansible.cfg JUNIT_OUTPUT_DIR="/tmp/artifacts" ansible-playbook ${PLAYBOOK} -vvvv || print_fail_and_exit
|
||
|
|
||
|
echo "======> Done."
|