mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-09-16 07:16:04 +02:00
Replaced {{ systemctl_id | get_service_script_path( by systemctl_script_exec
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# roles/sys-systemctl/tasks/03_base.yml
|
||||
- name: "find best matching source for service script"
|
||||
set_fact:
|
||||
service_src: >-
|
||||
systemctl_script_src: >-
|
||||
{{ lookup('first_found',
|
||||
{
|
||||
'files': [
|
||||
@@ -20,7 +20,7 @@
|
||||
include_tasks: 04_files.yml
|
||||
when:
|
||||
- systemctl_copy_files | bool
|
||||
- service_src
|
||||
- systemctl_script_src
|
||||
|
||||
- name: "Load systemctl logic for '{{ systemctl_id }}'"
|
||||
include_tasks: 05_service.yml
|
||||
|
@@ -9,15 +9,15 @@
|
||||
block:
|
||||
- name: "render template"
|
||||
template:
|
||||
src: "{{ service_src }}"
|
||||
dest: "{{ [systemctl_script_dir, (service_src | basename | regex_replace('\\.j2$', ''))] | path_join }}"
|
||||
src: "{{ systemctl_script_src }}"
|
||||
dest: "{{ [systemctl_script_dir, (systemctl_script_src | basename | regex_replace('\\.j2$', ''))] | path_join }}"
|
||||
mode: "0755"
|
||||
when: service_src.endswith('.j2')
|
||||
when: systemctl_script_src.endswith('.j2')
|
||||
|
||||
- name: "copy raw file"
|
||||
copy:
|
||||
src: "{{ service_src }}"
|
||||
dest: "{{ [systemctl_script_dir, (service_src | basename)] | path_join }}"
|
||||
src: "{{ systemctl_script_src }}"
|
||||
dest: "{{ [systemctl_script_dir, (systemctl_script_src | basename)] | path_join }}"
|
||||
mode: "0755"
|
||||
when: not service_src.endswith('.j2')
|
||||
when: not systemctl_script_src.endswith('.j2')
|
||||
when: systemctl_copy_files | bool
|
||||
|
@@ -4,4 +4,4 @@ OnFailure={{ SYS_SERVICE_ON_FAILURE_COMPOSE }}
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/bin/bash {{ systemctl_id | get_service_script_path( service_src | basename | regex_replace('\\.j2$', '') | filetype ) }}
|
||||
ExecStart={{ systemctl_script_exec }}
|
||||
|
@@ -8,4 +8,10 @@ systemctl_script_dir: "{{ [ PATH_SYSTEMCTL_SCRIPTS, systemctl_id ] | path_jo
|
||||
## Settings
|
||||
systemctl_copy_files: true # When set to false file copying will be skipped
|
||||
systemctl_timer_enabled: false # When set to true timmer will be loaded
|
||||
systemctl_state: "{{ SYS_SERVICE_DEFAULT_STATE }}"
|
||||
systemctl_state: "{{ SYS_SERVICE_DEFAULT_STATE }}"
|
||||
|
||||
# Dynamic Loaded ( Just available when dependencies are loaded )
|
||||
systemctl_script_base: "{{ systemctl_script_src | basename | regex_replace('\\.j2$', '') }}"
|
||||
systemctl_script_type: "{{ systemctl_script_base | filetype }}"
|
||||
systemctl_script_inter: "/bin/{{ 'bash' if systemctl_script_type == 'sh' else 'python3'}}"
|
||||
systemctl_script_exec: "{{ systemctl_script_inter }} {{ systemctl_id | get_service_script_path( systemctl_script_type ) }}"
|
Reference in New Issue
Block a user