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.
Templates usually are stored under “templates” directories with “. j2” file extension. The “dest” parameter specifies the path where to render the template on the remote machine. The “validate” parameters allow you to specify the validation command to run before copying it into place.
Sample directory layout By default, Ansible assumes your playbooks are stored in one directory with roles stored in a sub-directory called roles/ . As you use Ansible to automate more tasks, you may want to move your playbooks into a sub-directory called playbooks/ .
Role Search Path By default, in /etc/ansible/roles.
We need to have two parameters when using the Ansible Template module, such as: src: The source of the template file. It can be a relative and absolute path. dest: Dest is the destination path on the remote server.
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/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With