Couldn't find anything google'ing.
There is group_vars/all/ for variables. Is there something similar for templates? I would like to use some templates across multiple roles.
Couldn't find anything google'ing.
There is group_vars/all/ for variables. Is there something similar for templates? I would like to use some templates across multiple roles.
You can put your global templates into templates
directory at the top level of Ansible layout (same level as group_vars
). BTW same goes for global files.
files/
group_vars/
roles/
site.yml
templates/
It was possible before 2.2.1, but not after. See issue 20442.
There's a patch that allows you to do out-of-scope includes.
Also as @René suggests you can try to put your common templates into some role and declare it as dependency or call include_role
. As far as I remember while digging the issue, Ansible adds all roles used in current context into search path.
A possible solution is to put the reusable template in a dependent role. See role dependencies.
© 2022 - 2024 — McMap. All rights reserved.