Kevin Veen-Birkenbach 42d6c1799b
sys-service: add systemd_directive filter and refactor service template
Introduced custom filter plugin to render optional systemd directives, refactored template to loop over directives, and adjusted default vars (TimeoutStartSec, RuntimeMaxSec handling).

Details: see ChatGPT conversation
https://chatgpt.com/share/68a5a730-6344-800f-b9a3-dc62d5902e9b
2025-08-20 12:46:07 +02:00

15 lines
501 B
Django/Jinja

[Unit]
Description={{ SOFTWARE_NAME }} - Service for role '{{ system_service_id }}'
{{- system_service_tpl_on_failure | systemd_directive('OnFailure') }}
[Service]
Type={{ system_service_tpl_type }}
{%- for key, val in [
('TimeoutStartSec', system_service_tpl_timeout_start_sec),
('ExecStartPre', system_service_tpl_exec_start_pre),
('ExecStart', system_service_tpl_exec_start),
('RuntimeMaxSec', system_service_tpl_runtime)
] -%}
{{- val | systemd_directive(key) }}
{%- endfor %}