kolla-ansible/ansible/roles/common/templates/td-agent.conf.j2
Mark Goddard 56a07702bc Performance: use a single config file for fluentd
Currently we generate multiple fluentd configuration files for inputs,
filters, formatters and outputs.
These are then included from the main td-agent.conf configuration file.
With a large number of hosts, this can take a long time to template.

Benchmarking of templating is available at [1].

This change switches to a single fluentd configuration file, with the
include done locally. For the default template files included with Kolla
Ansible we use Jinja includes, but this does not work with templates in
a different directory. We therefore use the Ansible template lookup
plugin, which has a slightly higher overhead than a jinja include, but
far lower than generating multiple templates. This should drastically
improve the performance of this task.

[1] https://github.com/stackhpc/ansible-scaling/blob/master/doc/template.md

Partially-Implements: blueprint performance-improvements

Change-Id: Ia8623be0aa861fea3e54d2c9e1c971dfd8e3afa9
2020-07-28 12:14:48 +01:00

46 lines
1.1 KiB
Django/Jinja

#jinja2: trim_blocks: False
{# Ansible restricts Jinja includes to the same directory or subdirectory of a
template. To support customised configuration outside of this path we use
the template lookup plugin. Jinja includes have a lower overhead, so we use
those where possible. #}
# Inputs
{%- for path in fluentd_input_files %}
# Included from {{ path }}:
{%- if path.startswith('/') %}
{{ lookup('template', path) }}
{%- else %}
{% include path %}
{%- endif %}
{%- endfor %}
# Filters
{%- for path in fluentd_filter_files %}
# Included from {{ path }}:
{%- if path.startswith('/') %}
{{ lookup('template', path) }}
{%- else %}
{% include path %}
{%- endif %}
{%- endfor %}
# Formats
{%- for path in fluentd_format_files %}
# Included from {{ path }}:
{%- if path.startswith('/') %}
{{ lookup('template', path) }}
{%- else %}
{% include path %}
{%- endif %}
{%- endfor %}
# Outputs
{%- for path in fluentd_output_files %}
# Included from {{ path }}:
{%- if path.startswith('/') %}
{{ lookup('template', path) }}
{%- else %}
{% include path %}
{%- endif %}
{%- endfor %}