Hi,
I am writing a role for varnish. Because Varnish configuration language is
a "real" language I can and will not restrict what configuration a user can
provide. To make it as flexible as possible I planned to use a variable with an
empty default. So a user of my role can provide a complete VCL in a playbook
like this:
- name: Configure varnish host
hosts: 'proxy'
sudo: True
vars:
varnish_vcl_content: |
backend default {
.host = foo
.port = 80
}
roles:
- { role: varnish }
Now my questions:
1. Do you think, this is a good practice?
2. Is there a recommended directory for templates outside of role directories?
Where would you put it? A user can fill the variable like this:
varnish_vcl_content: "{{ lookup('template', 'default.vcl') }}"