Skip to content

Instantly share code, notes, and snippets.

@tristanbes

tristanbes/build_pr.sh

Last active Aug 29, 2015
Embed
What would you like to do?
#!/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
You can’t perform that action at this time.