mirror of
https://github.com/prometheus-community/ansible
synced 2024-11-26 13:50:20 +00:00
2f1e8a4be8
Add role for deploying the chrony_exporter. Signed-off-by: SuperQ <superq@gmail.com>
50 lines
1.5 KiB
Django/Jinja
50 lines
1.5 KiB
Django/Jinja
{{ ansible_managed | comment }}
|
|
|
|
[Unit]
|
|
Description=Prometheus Chrony Exporter
|
|
After=network-online.target
|
|
|
|
[Service]
|
|
Type=simple
|
|
User={{ chrony_exporter_system_user }}
|
|
Group={{ chrony_exporter_system_group }}
|
|
ExecStart={{ chrony_exporter_binary_install_dir }}/chrony_exporter \
|
|
{% for collector in chrony_exporter_enabled_collectors -%}
|
|
{% if not collector is mapping %}
|
|
'--collector.{{ collector }}' \
|
|
{% else -%}
|
|
{% set name, options = (collector.items()|list)[0] -%}
|
|
'--collector.{{ name }}' \
|
|
{% for k,v in options|dictsort %}
|
|
'--collector.{{ name }}.{{ k }}={{ v }}' \
|
|
{% endfor -%}
|
|
{% endif -%}
|
|
{% endfor -%}
|
|
{% for collector in chrony_exporter_disabled_collectors %}
|
|
'--no-collector.{{ collector }}' \
|
|
{% endfor %}
|
|
{% if chrony_exporter_tls_server_config | length > 0 or chrony_exporter_http_server_config | length > 0 or chrony_exporter_basic_auth_users | length > 0 %}
|
|
'--web.config.file=/etc/chrony_exporter/web_config.yaml' \
|
|
{% endif %}
|
|
'--web.listen-address={{ chrony_exporter_web_listen_address }}' \
|
|
'--web.telemetry-path={{ chrony_exporter_web_telemetry_path }}'
|
|
|
|
SyslogIdentifier=chrony_exporter
|
|
Restart=always
|
|
RestartSec=1
|
|
StartLimitInterval=0
|
|
|
|
ProtectHome=yes
|
|
NoNewPrivileges=yes
|
|
|
|
{% if (ansible_facts.packages.systemd | first).version is version('232', '>=') %}
|
|
ProtectSystem=strict
|
|
ProtectControlGroups=true
|
|
ProtectKernelModules=true
|
|
ProtectKernelTunables=yes
|
|
{% else %}
|
|
ProtectSystem=full
|
|
{% endif %}
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|