Skip to main content Logo

Quis custodiet ipsos custodes?
Home | About | All pages | Cluster Status | RSS Feed

Ansible - create playbooks and role file and folder structure

Published: 08-09-2016 | Author: Remy van Elst | Text only version of this article

❗ This post is over seven years old. It may no longer be up to date. Opinions may have changed.

Because I always forget which folders and files go into a playbook folder. Based on the best practices page


Recently I removed all Google Ads from this site due to their invasive tracking, as well as Google Analytics. Please, if you found this content useful, consider a small donation using any of the options below:

I'm developing an open source monitoring app called Leaf Node Monitoring, for windows, linux & android. Go check it out!

Consider sponsoring me on Github. It means the world to me if you show your appreciation and you'll help pay the server costs.

You can also sponsor me by getting a Digital Ocean VPS. With this referral link you'll get $100 credit for 60 days.

To create a new Ansile project:

mkdir -p new_project
cd new_project
# inventory and master playbook
touch production staging site.yml 
# folders
mkdir -p group_vars host_vars library filter_plugins

To create a role with all the folders (role is named common):

mkdir -p roles/common/{tasks,handlers,templates,files,vars,defaults,meta}
touch roles/common/{tasks,handlers,templates,files,vars,defaults,meta}/main.yml
Tags: ansible , python , snippets