diff --git a/defaults/main.yml b/defaults/main.yml index 73a6b9e..8dda35b 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -119,8 +119,8 @@ systemd_environment: {} # will be used to generate systemd overrides in /etc/systemd/system/service_name.service.d/overrides.conf # `systemd_overrides_only` -- (optional) Boolean variable, when True no service_name.service will be generated and role # will place only overrides for the existing service. -# `systemd_run_dir` -- (optional) Run directory that will be used for service runtime. Service name is added to the path -# `systemd_lock_dir` -- (optional) Lock directory that will be used for service runtime. Service name is added to the path +# `systemd_run_dir` -- (optional) Run directory that will be used for service runtime. Service slice or name is added to the path +# `systemd_lock_dir` -- (optional) Lock directory that will be used for service runtime. Service slice or name is added to the path # Under the service dictionary the "sockets" key can be added, which may contain list of the sockets # for the given service_name. Each socket in the lsit may have following structure: diff --git a/tasks/main.yml b/tasks/main.yml index efbfa4b..c60ead8 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -30,7 +30,7 @@ - name: Create TEMP run dir file: - path: "{{ item.systemd_run_dir | default(systemd_run_dir) }}/{{ item.service_name | replace(' ', '_') }}" + path: "{{ item.systemd_run_dir | default(systemd_run_dir) }}/{{ item.systemd_slice_name | default(systemd_slice_name) | replace(' ', '_') }}" state: directory owner: "{{ item.systemd_user_name | default(systemd_user_name) }}" group: "{{ item.systemd_group_name | default(systemd_group_name) }}" @@ -41,7 +41,7 @@ - name: Create TEMP service lock dir file: - path: "{{ item.systemd_lock_dir | default(systemd_lock_dir) }}/{{ item.service_name | replace(' ', '_') }}" + path: "{{ item.systemd_lock_dir | default(systemd_lock_dir) }}/{{ item.systemd_slice_name | default(systemd_slice_name) | replace(' ', '_') }}" state: directory owner: "{{ item.systemd_user_name | default(systemd_user_name) }}" group: "{{ item.systemd_group_name | default(systemd_group_name) }}" diff --git a/templates/systemd-tmpfiles.j2 b/templates/systemd-tmpfiles.j2 index efc2e8a..9ea6858 100644 --- a/templates/systemd-tmpfiles.j2 +++ b/templates/systemd-tmpfiles.j2 @@ -1,4 +1,4 @@ # {{ ansible_managed }} -D {{ item.systemd_lock_dir | default(systemd_lock_dir) }}/{{ item.service_name | replace(' ', '_') }} 2755 {{ item.systemd_user_name | default(systemd_user_name) }} {{ item.systemd_group_name | default(systemd_group_name) }} -D {{ item.systemd_run_dir | default(systemd_run_dir) }}/{{ item.service_name | replace(' ', '_') }} 2755 {{ item.systemd_user_name | default(systemd_user_name) }} {{ item.systemd_group_name | default(systemd_group_name) }} +D {{ item.systemd_lock_dir | default(systemd_lock_dir) }}/{{ item.systemd_slice_name | default(systemd_slice_name) | replace(' ', '_') }} 2755 {{ item.systemd_user_name | default(systemd_user_name) }} {{ item.systemd_group_name | default(systemd_group_name) }} +D {{ item.systemd_run_dir | default(systemd_run_dir) }}/{{ item.systemd_slice_name | default(systemd_slice_name) | replace(' ', '_') }} 2755 {{ item.systemd_user_name | default(systemd_user_name) }} {{ item.systemd_group_name | default(systemd_group_name) }}