Created
July 9, 2014 18:45
-
-
Save drGrove/bd4f3fdcfb6c968bae13 to your computer and use it in GitHub Desktop.
A Ansible-Playbook Wrapper
This file contains hidden or 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 | |
| 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