ansible-collection-prometheus/roles/blackbox_exporter/templates/blackbox_exporter.service.j2
Thomas Venieris 791b9b1290
feature: Make config installation dir configurable (#173)
* feature: Make config installation dir configurable

Signed-off-by: Thomas Venieris <thomas.venieris@gmail.com>

* fix: blackbox_exporter_config_dir consistent

- Made blackbox_exporter_config_dir parameter consistent with other
  collection roles
- Added new parameter to meta/argument_specs.yml

Signed-off-by: Thomas Venieris <thomas.venieris@gmail.com>

---------

Signed-off-by: Thomas Venieris <thomas.venieris@gmail.com>
2023-07-29 17:43:24 +02:00

45 lines
1.1 KiB
Django/Jinja

{{ ansible_managed | comment }}
[Unit]
Description=Blackbox Exporter
After=network-online.target
StartLimitInterval=0
StartLimitIntervalSec=0
[Service]
Type=simple
User={{ blackbox_exporter_user }}
Group={{ blackbox_exporter_group }}
PermissionsStartOnly=true
ExecReload=/bin/kill -HUP $MAINPID
ExecStart=/usr/local/bin/blackbox_exporter \
--config.file={{ blackbox_exporter_config_dir }}/blackbox_exporter.yml \
{% for flag, flag_value in blackbox_exporter_cli_flags.items() -%}
--{{ flag }}={{ flag_value }} \
{% endfor -%}
--web.listen-address={{ blackbox_exporter_web_listen_address }}
SyslogIdentifier=blackbox_exporter
KillMode=process
Restart=always
RestartSec=5
LockPersonality=true
NoNewPrivileges=true
MemoryDenyWriteExecute=true
PrivateTmp=true
ProtectHome=true
RemoveIPC=true
RestrictSUIDSGID=true
AmbientCapabilities=CAP_NET_RAW
{% if (ansible_facts.packages.systemd | first).version is version('232', '>=') %}
ProtectControlGroups=true
ProtectKernelModules=true
ProtectKernelTunables=yes
ProtectSystem=strict
{% else %}
ProtectSystem=full
{% endif %}
[Install]
WantedBy=multi-user.target