mirror of
https://github.com/prometheus-community/ansible
synced 2024-11-22 03:43:09 +00:00
enhancement(node_exporter): use systemd to create node_exporter_textfile_dir if it
doesn't exist Signed-off-by: Siyuan Miao <i@xswan.net>
This commit is contained in:
parent
c72059ffb2
commit
59516b5810
1 changed files with 10 additions and 0 deletions
|
@ -8,6 +8,16 @@ After=network-online.target
|
|||
Type=simple
|
||||
User={{ node_exporter_system_user }}
|
||||
Group={{ node_exporter_system_group }}
|
||||
{% if node_exporter_textfile_dir | length > 0 %}
|
||||
{% if (ansible_facts.packages.systemd | first).version is version('235', '>=') %}
|
||||
ExecStartPre=+/bin/mkdir -p {{ node_exporter_textfile_dir }}
|
||||
ExecStartPre=+/bin/chown -R {{ node_exporter_system_user }}:{{ node_exporter_system_group }} {{ node_exporter_textfile_dir }}
|
||||
{% else %}
|
||||
ExecStartPre=/bin/mkdir -p {{ node_exporter_textfile_dir }}
|
||||
ExecStartPre=/bin/chown -R {{ node_exporter_system_user }}:{{ node_exporter_system_group }} {{ node_exporter_textfile_dir }}
|
||||
PermissionsStartOnly=true
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
ExecStart={{ node_exporter_binary_install_dir }}/node_exporter \
|
||||
{% for collector in node_exporter_enabled_collectors -%}
|
||||
{% if not collector is mapping %}
|
||||
|
|
Loading…
Reference in a new issue