When rendering the node_exporter systemd service unit from the Jinja2 template, collector arguments receive inconsistent leading whitespace.
Example of rendered output:
ExecStart=/usr/local/bin/node_exporter \
'--collector.systemd' \
'--collector.textfile' \
'--collector.textfile.directory=/var/lib/node_exporter' \
'--collector.filesystem' \
'--collector.filesystem.ignored-fs-types=^(sys|proc|auto)fs$' \
'--collector.filesystem.ignored-mount-points=^/(sys|proc|dev)($|/)' \
'--web.listen-address=0.0.0.0:9100' \
'--web.telemetry-path=/metrics'
The line for mapping-style collectors (textfile, filesystem) lose their indentation, while simple string collectors are correctly indented.
Root cause:
Whitespace control (-%}) combined with the different code paths for string vs. mapping collectors in the Jinja2 template produces uneven leading spaces.
Variables that trigger the issue:
node_exporter_enabled_collectors:
- systemd
- textfile:
directory: "{{ node_exporter_textfile_dir }}"
- filesystem:
ignored-mount-points: "^/(sys|proc|dev)($|/)"
ignored-fs-types: "^(sys|proc|auto)fs$"
node_exporter_disabled_collectors: []
When rendering the node_exporter systemd service unit from the Jinja2 template, collector arguments receive inconsistent leading whitespace.
Example of rendered output:
The line for mapping-style collectors (textfile, filesystem) lose their indentation, while simple string collectors are correctly indented.
Root cause:
Whitespace control (-%}) combined with the different code paths for string vs. mapping collectors in the Jinja2 template produces uneven leading spaces.
Variables that trigger the issue: