mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-26 21:45:20 +02:00
- Unified variable naming: system_service_id → systemctl_id - Added automatic removal of trailing '@' for role directory resolution - Improved first_found search: prefer target role, fallback to sys-systemctl defaults - Split template resolution logic to avoid undefined variable errors - Added assertion in sys-timer to forbid '@' in systemctl_id - Corrected default systemctl.service.j2 template description - Cleaned up path handling and script directory generation Context: conversation about fixing template resolution and @ handling https://chatgpt.com/share/68a39994-1bb0-800f-a219-109e643c3efb
30 lines
815 B
YAML
30 lines
815 B
YAML
# roles/sys-systemctl/tasks/03_base.yml
|
|
- name: "find best matching source for service script"
|
|
set_fact:
|
|
service_src: >-
|
|
{{ lookup('first_found',
|
|
{
|
|
'files': [
|
|
'templates/script.sh.j2',
|
|
'templates/script.py.j2',
|
|
'files/script.sh',
|
|
'files/script.py'
|
|
],
|
|
'paths': [ systemctl_role_dir ]
|
|
},
|
|
errors='strict'
|
|
) }}
|
|
when: systemctl_copy_files | bool
|
|
|
|
- name: "Load file logic for '{{ systemctl_id }}'"
|
|
include_tasks: 04_files.yml
|
|
when:
|
|
- systemctl_copy_files | bool
|
|
- service_src
|
|
|
|
- name: "Load systemctl logic for '{{ systemctl_id }}'"
|
|
include_tasks: 05_service.yml
|
|
|
|
- name: "Load timer logic for '{{ systemctl_id }}'"
|
|
include_tasks: 06_timer.yml
|
|
when: systemctl_timer_enabled | bool |