Last active
August 29, 2015 14:19
-
-
Save tristanbes/5d8189fd23ebcfee12b4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
YPROX_PR=$1 | |
DB_RESET=$2 | |
echo "Building "$YPROX_PR | |
# build the new PR | |
cd /var/www/gh_hook/scripts | |
# Tower server needs variable to launch the playbook. We provide them inside a yml file. | |
if [[ $DB_RESET ]]; then | |
sed -e "s;%YPROX_PR%;$YPROX_PR;g" -e "s;%YPROX_DB_RESET%;true;g" extra_vars.yml > extra_vars_$YPROX_PR.yml | |
else | |
sed -e "s;%YPROX_PR%;$YPROX_PR;g" -e "s;%YPROX_DB_RESET%;false;g" extra_vars.yml > extra_vars_$YPROX_PR.yml | |
fi | |
# Tells tower to launches the deploy playbook with extra vars containted in the file created before | |
tower-cli job launch --job-template 18 --extra-vars extra_vars_$YPROX_PR.yml | |
# If you don't have a tower server, you can simply launch a playbook with ansible | |
# ansible-playbook -i inventory-prod yproximite_pr.yml -utristanbes -K -eyprox_pr=$YPROX_PR -edb_reset=$DB_RESET | |
rm extra_vars_$YPROX_PR.yml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment