ansible-collection-prometheus/roles/fail2ban_exporter/templates/fail2ban_exporter.service.j2
gardar a3f317588d
refactor(fail2ban_exporter): delegate common tasks to _common role
Signed-off-by: gardar <gardar@users.noreply.github.com>
2024-10-15 17:04:55 +00:00

40 lines
1 KiB
Django/Jinja

{{ ansible_managed | comment }}
[Unit]
Description=Prometheus fail2ban_exporter
After=network-online.target
[Service]
Type=simple
User={{ fail2ban_exporter_system_user }}
Group={{ fail2ban_exporter_system_group }}
ExecStart={{ fail2ban_exporter_binary_install_dir }}/fail2ban_exporter \
--web.listen-address={{ fail2ban_exporter_web_listen_address }} \
{% if fail2ban_exporter_username | length > 0 -%}
--web.basic-auth.username={{ fail2ban_exporter_username }}
{% endif %}
{% if fail2ban_exporter_password | length > 0 -%}
--web.basic-auth.password={{ fail2ban_exporter_password }}
{% endif %}
--collector.f2b.socket={{ fail2ban_exporter_socket }}
SyslogIdentifier=fail2ban_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