On Fri, Feb 28, 2014 at 4:45 PM, Ben Hood <
0x6e...@gmail.com> wrote:
> TL;DR: I'd like to factor out the commonalities of my role definitions
> into re-useable templates and I was wondering what the best way to do
> this is.
So I'm playing with the following global include task definition that
produces per-role include configs for syslog-ng:
- name: Template out the included syslog configuration file
action: template src=roles/{{ role }}/templates/syslog/{{ role
}}.conf.j2 dest={{ syslog_include_dir }}/{{ role }}.conf
notify:
- reload syslog
tags:
- syslog
It seems to work. There are a couple of hacky aspects to this:
- The role that includes this task definition needs to define a
variable called "role" - there might be a better way to do
- The task definition needs to specify the full path to the per-role template
Does this seem reasonable or am I missing a trick?