mirror of
				https://github.com/kevinveenbirkenbach/computer-playbook.git
				synced 2025-10-31 10:19:09 +00:00 
			
		
		
		
	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
This commit is contained in:
		| @@ -1,15 +1,14 @@ | ||||
| [Unit] | ||||
| Description={{ SOFTWARE_NAME }} - Service for role '{{ system_service_id }}' | ||||
| {% if system_service_tpl_on_failure |length > 0 %} | ||||
| OnFailure={{ system_service_tpl_on_failure }} | ||||
| {% endif %} | ||||
| {{- system_service_tpl_on_failure | systemd_directive('OnFailure') }} | ||||
|  | ||||
| [Service] | ||||
| Type={{ system_service_tpl_type }} | ||||
| {% if system_service_tpl_exec_start_pre |length > 0 %} | ||||
| ExecStartPre={{ system_service_tpl_exec_start_pre }} | ||||
| {% endif %} | ||||
| ExecStart={{ system_service_tpl_exec_start }} | ||||
| {% if system_service_tpl_runtime |length > 0 %} | ||||
| RuntimeMaxSec={{ system_service_tpl_runtime }} | ||||
| {% endif %} | ||||
| {%- 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 %} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user