I know it's possible to include tasks / handlers files in other similar files via lines like the following
- name: Configure django
include: django.yml
- name: Configure nginx reverse proxy
include: nginx.yml
But according to the documentation, it doesn't seem as if this functionality exists for files under vars/
or defaults/
. The problem I'm facing is that I have a lot of variables which modify fundamentally different aspects of a role, but all of the variables are just divided into different sections within the same file (defaults/main.yml
) using comments (e.g. # BEGIN RoR config vars
... # END RoR config vars
).
It's very ugly and unwieldy, but more to the point it's not modular, and it makes maintaining the thing that much more difficult.
Edit: Since someone voted to close because they felt this was unclear...
This is akin to what I have (all in one file):
## Database variables
database:
user: bob
pass: bobs_pass
host: dbhost
## Server variable
server:
su_user: nobody
max_connections: 50
Giving ls -R output of:
./defaults/main.yml
And this is what I'd prefer to have:
- name: Include database vars
include: database.yml
- name: Include app server vars
include: server.yml
With ls -R output:
./defaults/main.yml
./defaults/database.yml
./defaults/server.yml