On Fri, Feb 28, 2014 at 4:45 PM, Ben Hood <[email protected]> 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?

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAB-G1jiNbtVk_kXXQE78gQ3gXN5skhoB21wKmUix_T9BsD%3DiVA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to