Update run and lock path for systemd
Since /var/run is a symlink to /run and /var/lock is a symlink to /run/lock for all modern operationg systems, it makes sense to change default paths that are used. To make such changes more flexible, ``systemd_run_dir`` and ``systemd_lock_dir`` are introduced. Change-Id: I60d321fcdce3d3a94233cc25c92898d9e9f2a9b8
This commit is contained in:
parent
9d14e194ca
commit
46185f389e
@ -62,6 +62,16 @@ systemd_service_config_overrides: {}
|
|||||||
# https://www.freedesktop.org/software/systemd/man/systemd.service.html#Type=
|
# https://www.freedesktop.org/software/systemd/man/systemd.service.html#Type=
|
||||||
systemd_default_service_type: simple
|
systemd_default_service_type: simple
|
||||||
|
|
||||||
|
# System run directory used for services by default.
|
||||||
|
# Service name will be added to make a unique path.
|
||||||
|
# This option can also be defined for specific service entries under "systemd_services".
|
||||||
|
systemd_run_dir: "/run"
|
||||||
|
|
||||||
|
# System lock directory used for services by default.
|
||||||
|
# Service name will be added to make a unique path.
|
||||||
|
# This option can also be defined for specific service entries under "systemd_services".
|
||||||
|
systemd_lock_dir: "/run/lock"
|
||||||
|
|
||||||
# Global lock path used for system services.
|
# Global lock path used for system services.
|
||||||
# This is an optional variable and will have no effect if undefined.
|
# This is an optional variable and will have no effect if undefined.
|
||||||
# This option can also be defined for specific service entries under "systemd_services".
|
# This option can also be defined for specific service entries under "systemd_services".
|
||||||
@ -114,6 +124,8 @@ systemd_environment: {}
|
|||||||
# will be used to generate systemd overrides in /etc/systemd/system/service_name.service.d/overrides.conf
|
# 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
|
# `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.
|
# 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
|
||||||
|
|
||||||
# Under the service dictionary the "sockets" key can be added, which may contain list of the sockets
|
# 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:
|
# for the given service_name. Each socket in the lsit may have following structure:
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Added variables ``systemd_run_dir`` and ``systemd_lock_dir`` that allows
|
||||||
|
to control run and lock path for directories that will be used by systemd
|
||||||
|
services. Variables should not include service name since it will be added
|
||||||
|
by default at the end of the provided path.
|
||||||
|
These variables could be also defined as keys inside ``systemd_services``
|
||||||
|
and this will have prescedence over default behaviour.
|
||||||
|
- |
|
||||||
|
Default run path for systemd services has been changed to ``/run`` and
|
||||||
|
lock path to ``/run/lock``.
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
- name: Create TEMP run dir
|
- name: Create TEMP run dir
|
||||||
file:
|
file:
|
||||||
path: "/var/run/{{ item.service_name | replace(' ', '_') }}"
|
path: "{{ item.systemd_run_dir | default(systemd_run_dir) }}/{{ item.service_name | replace(' ', '_') }}"
|
||||||
state: directory
|
state: directory
|
||||||
owner: "{{ item.systemd_user_name | default(systemd_user_name) }}"
|
owner: "{{ item.systemd_user_name | default(systemd_user_name) }}"
|
||||||
group: "{{ item.systemd_group_name | default(systemd_group_name) }}"
|
group: "{{ item.systemd_group_name | default(systemd_group_name) }}"
|
||||||
@ -41,16 +41,19 @@
|
|||||||
|
|
||||||
- name: Create TEMP service lock dir
|
- name: Create TEMP service lock dir
|
||||||
file:
|
file:
|
||||||
path: "/var/lock/{{ item.service_name | replace(' ', '_') }}"
|
path: "{{ item.systemd_lock_dir | default(systemd_lock_dir) }}/{{ item.service_name | replace(' ', '_') }}"
|
||||||
state: directory
|
state: directory
|
||||||
owner: "{{ item.systemd_user_name | default(systemd_user_name) }}"
|
owner: "{{ item.systemd_user_name | default(systemd_user_name) }}"
|
||||||
group: "{{ item.systemd_group_name | default(systemd_group_name) }}"
|
group: "{{ item.systemd_group_name | default(systemd_group_name) }}"
|
||||||
mode: "02755"
|
mode: "02755"
|
||||||
with_items: "{{ systemd_services }}"
|
with_items: "{{ systemd_services }}"
|
||||||
|
when:
|
||||||
|
- (item.systemd_lock_path is not defined) and
|
||||||
|
(systemd_lock_path is not defined)
|
||||||
tags:
|
tags:
|
||||||
- systemd-service
|
- systemd-service
|
||||||
|
|
||||||
- name: Create TEMP defined lock dir
|
- name: Create TEMP defined lock path
|
||||||
file:
|
file:
|
||||||
path: "{{ item.systemd_lock_path | default(systemd_lock_path) }}"
|
path: "{{ item.systemd_lock_path | default(systemd_lock_path) }}"
|
||||||
state: directory
|
state: directory
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
{% if (item.systemd_lock_path is defined) or (systemd_lock_path is defined) %}
|
{% if (item.systemd_lock_path is defined) or (systemd_lock_path is defined) %}
|
||||||
D {{ item.systemd_lock_path | default(systemd_lock_path) }} 2755 {{ item.systemd_user_name | default(systemd_user_name) }} {{ item.systemd_group_name | default(systemd_group_name) }}
|
D {{ item.systemd_lock_path | default(systemd_lock_path) }} 2755 {{ item.systemd_user_name | default(systemd_user_name) }} {{ item.systemd_group_name | default(systemd_group_name) }}
|
||||||
D {{ (item.systemd_lock_path | default(systemd_lock_path)) | replace('lock', 'run') }} 2755 {{ item.systemd_user_name | default(systemd_user_name) }} {{ item.systemd_group_name | default(systemd_group_name) }}
|
D {{ (item.systemd_lock_path | default(systemd_lock_path)) | replace('lock', 'run') }} 2755 {{ item.systemd_user_name | default(systemd_user_name) }} {{ item.systemd_group_name | default(systemd_group_name) }}
|
||||||
|
{% else %}
|
||||||
|
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) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
D /var/lock/{{ item.service_name | replace(' ', '_') }} 2755 {{ item.systemd_user_name | default(systemd_user_name) }} {{ item.systemd_group_name | default(systemd_group_name) }}
|
|
||||||
D /var/run/{{ item.service_name | replace(' ', '_') }} 2755 {{ item.systemd_user_name | default(systemd_user_name) }} {{ item.systemd_group_name | default(systemd_group_name) }}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user