Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
mkrole - create an ansible role skeleton
#!/bin/sh
# create the directory structure and some files
# for an ansible role
ROLE=$1
if [ -z "$ROLE" ]; then
echo "need a role name"
exit 1
fi
mkdir -p $ROLE/{tasks,handlers,templates,files,vars,meta}
echo "---" | tee $ROLE/{tasks,handlers,vars,meta}/main.yml > /dev/null
@shiplu

This comment has been minimized.

Copy link

commented Sep 13, 2016

Good use of tee

@choppedpork

This comment has been minimized.

Copy link

commented Sep 19, 2016

This only works if sh is an alias to bash (which is very often not true) - I've had to change the shebang to point at bash. Sorry for commenting instead of creating a PR - that seemed a bit too excessive for adding two characters into your script! :)

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.