add node_exporter role

This commit is contained in:
2022-08-30 07:49:00 -05:00
parent 3e982b9729
commit d5fd90a9e9
13 changed files with 398 additions and 0 deletions

View File

@ -0,0 +1,32 @@
[Unit]
Description=Node Exporter
After=network-online.target
[Service]
Type=simple
User={{ node_exporter_user }}
Group={{ node_exporter_group }}
ExecStart={{ node_exporter_bin_path }}/node_exporter \
{% if node_exporter_collectors_enabled %}
{% for collector in node_exporter_collectors_enabled %}
{% if collector is mapping %}
{% set name, opts = (collector.items() | list)[0] %}
--collector.{{ name }} \
{% for k, v in opts.items() %}
{% if v is none %}
--collector.{{ name }}.{{ k }} \
{% elif v is string %}
--collector.{{ name }}.{{ k }}={{ v }} \
{% endif %}
{% endfor %}
{% else %}
--collector.{{ collector }} \
{% endif %}
{% endfor %}
{% endif %}
Restart=always
RestartSec=1
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,5 @@
{% if node_exporter_machine_roles is defined %}
{% for role in node_exporter_machine_roles %}
machine_role{role="{{ role }}"} 1
{% endfor %}
{% endif %}