idealista / fluentd-role

Ansible role to install fluentd
Apache License 2.0
10 stars 11 forks source link

Templating fluent.conf #2

Closed jnogol closed 6 years ago

jnogol commented 6 years ago

Description

In tasks/config.yml there is a task that copies fluent.conf from files. It would be interesting templating this file instead of copying, because we can then use this role to deploy fluentd to different hosts.

jnogol commented 6 years ago

Problem is that, using the role within a playbook, is not possible to override the role template. A workaround could be changing the template src to a variable, so it can be changed in the playbook and therefore there is no need to add a new task.

- name: FLUENTD | Copy server config
  template:
    src: "{{ fluentd_config_template }}"

In the role's defaults/main.yml:

fluentd_config_template: fluentd/fluent.conf

In the playbook:

fluentd_config_template: "{{ playbook_dir }}/templates/path/to/template"

What do you think, @jdvr @jmonterrubio @dortegau?

jdvr commented 6 years ago

I think it's ok, the other alternatives are not better so, This would be a good implementation.