Skip to content

Instantly share code, notes, and snippets.

@proxypoke
Created August 27, 2014 16:55
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save proxypoke/73029600a6c63d12e8a7 to your computer and use it in GitHub Desktop.
Save proxypoke/73029600a6c63d12e8a7 to your computer and use it in GitHub Desktop.
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
Copy link

shiplu commented Sep 13, 2016

Good use of tee

@choppedpork
Copy link

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