Skip to content

Instantly share code, notes, and snippets.

@cjlyth
Last active May 22, 2018 13:03
Show Gist options
  • Save cjlyth/61051da5b14f0f03a2fb460a37abed92 to your computer and use it in GitHub Desktop.
Save cjlyth/61051da5b14f0f03a2fb460a37abed92 to your computer and use it in GitHub Desktop.
Bash function to create Ansible roles following (current) best practices
# http://docs.ansible.com/ansible/latest/user_guide/playbooks_best_practices.html#directory-layout
mkrole()
{
dir_name=${1:-'common'}
mkdir -p roles/$dir_name/{tasks,handlers,templates,files,vars,defaults,meta}
touch roles/$dir_name/{tasks,handlers,vars,defaults,meta}/main.yml
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment