Skip to content

Instantly share code, notes, and snippets.

@drGrove
Created July 9, 2014 18:45
Show Gist options
  • Select an option

  • Save drGrove/bd4f3fdcfb6c968bae13 to your computer and use it in GitHub Desktop.

Select an option

Save drGrove/bd4f3fdcfb6c968bae13 to your computer and use it in GitHub Desktop.
A Ansible-Playbook Wrapper
#!/bin/bash
FILE=$1
if [ ! -z $2 ]
then
SCRIPTS_PATH=$2
else
if [ ! -z $ANSIBLE_SCRIPTS ]
then
SCRIPTS_PATH=$ANSIBLE_SCRIPTS
else
if [ ! -e $FILE ]
then
echo "This file was not found in the current directory."
echo "No ANSIBLE_SCRIPTS Environment Variable is set and Path is
not defined. Please define a path by adding ANSIBLE_SCRIPTS to your
bash profile."
exit 0
fi
fi
fi
if [ ! -e $SCRIPTS_PATH/$FILE.yml ]
then
echo "File not found at ${SCRIPTS_PATH}/${FILE}.yml"
exit 0
else
ansible-playbook $SCRIPTS_PATH/$FILE.yml
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment