# Referencing paths inside roles

**URL:** <https://forum.ansible.com/t/referencing-paths-inside-roles/12581>\
**Category:** Ansible Project\
**Tags:** ansible-project\
**Created:** [March 25, 2013, 7:20pm UTC](https://forum.ansible.com/t/referencing-paths-inside-roles/12581 "2013-03-25T19:20:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Serge\_van\_Ginderacht](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@Serge\_van\_Ginderacht](https://forum.ansible.com/u/Serge_van_Ginderacht)\
**Post date:** [March 25, 2013, 7:20pm UTC](https://forum.ansible.com/t/referencing-paths-inside-roles/12581/1 "2013-03-25T19:20:08Z")

</div>

My take on the problem atm is to put all playbooks and all tasks, respectively, on the same level. To have clean includes, I put a symlink to the common include folder in every projects folder, where the playbooks reside.

- Common tasks are in ./inc/tasks
- Common playbooks are in ./projects/playbooks and symlinked to ./inc/playbooks/
- Every project lives in its own dir ./projects/${projectname}/ and has as subolder/files:
- inc/ symlinked
- hosts
- group\_vars/  
hosts & group vars are merged to ./hosts & ./group\_vars by a wrapper script

So task includes allways take the form of “include: inc/tasks/${task\_name}”

Normally we never run ansible-playbook directly, but have a wrapper script which does several things, like setting environment paths, ansible.cfg, running inventory scripts, limitting ansible to dev, staging or production, mergings hosts and group\_vars, generating hosts\_vars, and so on. It also takes care of e.g. the inc/ symlinks which obviosuly are in .gitignore just like ./hosts and ./group\_vars

Serge

.  
├── bin  
├── group\_vars  
├── host\_vars  
├── hosts  
├── inc  
│ ├── scripts  
│ ├── tasks  
│ ├── templates  
│ └── tmp

└── projects  
├── ALL  
│ ├── group\_vars  
│ ├── hosts  
│ └── inc → …/…/inc  
├── project1  
│ ├── group\_vars  
│ ├── hosts  
│ ├── files  
│ └── inc → …/…/inc

├── project2  
│ ├── group\_vars

│ ├── templates  
│ ├── hosts  
│ └── inc → …/…/inc
