Files
computer-playbook/roles/sys-service/tasks/07_timer.yml
kevinveenbirkenbachandClaude Opus 5 99f7e03845 feat(sys-service): carry unit ordering, an Install section and a user scope
The generic unit template could express neither an ordering dependency nor an Install section, so a role needing either shipped its own templates/systemctl.service.j2 and re-answered the daemon reload, the enable and the flush behaviour by hand.

Add After, Before, Wants, RemainAfterExit and a WantedBy driven Install section, all inert at their defaults, and route the unit path, its owner, become and the systemctl probes through a system_service_scope so a per-login unit lands under the user's own systemd directory.

00_core is gated on the system scope rather than only its prune and lockdown steps: it sets run_once_sys_service, so a user-scope caller running first would otherwise skip the lockdown for every system-scope role behind it in the same play.

Rendering the previous template against the same inputs drops no directive and adds none; the only difference is the blank line an empty directive used to leave behind.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-15 18:09:43 +02:00

26 lines
914 B
YAML

---
- name: 🛑 Fail if a timer is asked for outside the system scope
assert:
that:
- system_service_scope == 'system'
fail_msg: >-
'{{ system_service_id }}' asks for a timer in the '{{ system_service_scope }}'
scope, but sys-timer writes into {{ DIR_SYSTEM_SERVICE }} and drives the unit
in the system scope, so the timer would look for a service that only exists
for the user.
- name: 🛑 Fail if system_service_id contains "@"
assert:
that:
- "'@' not in system_service_id"
fail_msg: "Invalid system_service_id '{{ system_service_id }}' → must not contain '@'."
when: MODE_ASSERT | bool
- name: "🔨 Make '{{ system_service_id }}' available for sys-timer"
set_fact:
system_service_timer_service: "{{ system_service_id }}"
- name: "📂 include role for sys-timer for {{ system_service_timer_service }}"
include_role:
name: sys-timer