Created
May 18, 2014 08:53
-
-
Save mookjp/e473a9e84de9473c4b84 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/sh | |
# Create role directory following in Ansible's best practices | |
# http://docs.ansible.com/playbooks_best_practices.html#directory-layout | |
function show_usage() { | |
echo "usage: $0 [<the name of role>]" | |
exit 0 | |
} | |
if [ `uname` = "Darwin" ] ; then | |
REALPATH_COMMAND="realpath" | |
elif [ `uname` = "Linux" ] ; then | |
REALPATH_COMMAND="readlink -f" | |
else | |
echo "It doesn't support this OS." | |
exit 1 | |
fi | |
EXE_DIR=`${REALPATH_COMMAND} .` | |
if [ -z $1 ] ; then | |
show_usage | |
fi | |
mkdir $1 | |
if [ $? -gt 0 ] ; then | |
echo "Couldn't create directory." | |
exit 1 | |
fi | |
cd $1 | |
mkdir tasks | |
touch tasks/main.yml | |
mkdir handlers | |
touch handlers/main.yml | |
mkdir templates | |
mkdir files | |
mkdir vars | |
touch vars/main.yml | |
mkdir meta | |
touch meta/main.yml | |
cd ${EXE_DIR} | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment