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