Thanks guys for your help,
I assume you confirm, that there is no such builtin feature in Ansible to manage inventory-level templates/files. I'm trying to keep away of doing custom things with Ansible like loading variables or files manually, but if that would be the only way of progressing, I'll go for your solution.
One caveat is, that I can't put any files in inventory directory, because Ansible tries to interpret them probably as inventory itself and fails with errors. I would need to store them on the side of the inventory directory. But I would use inventory_dir you @Yannig suggested variable to construct the directory name for this (something like {{inventory_dir}}.files or similar).
A bit off-topic I mentioned, was the default nested variables. @Jon, what I meant is that according to my knowledge it's hard to manage defaults of nested variables and override them selectively. Sth like the following:
My default in the role would be:
master:
node1: abc
node2: def
node3: ghi
And now I would like to just specify one master.node3 in inventory group_vars, without touching the rest, sth like:
master.node3: xyz
# OR
master:
node3: xyz
This didn't work for me in Ansible. Of course there are workarounds:
1. specify hash_behaviour=merge in ansible.cfg. This is unacceptable for me, because ansible.cfg is user specific, external to playbooks. So I can't enforce users to put it in their configs.
2. Copy whole defaults even if I want to modify just a single value. This solution denies the purpose of defaults.
3. Do advanced yaml hacking, that I'm not yet aware of (using of aliases, etc.)
4. Use jinja2 hash_merge filters to merge the defaults with what user provides. Use it in every role as a practice.
Do you agree with me, that there is no acceptable solution for this problem?