Fix global lock path usage
The option `systemd_lock_path` is intended to be set globally and locally however the global implementation has never been implemented. * The global option will ensure the run and lock path is setup for all services within the `systemd_services` array. * The local option provices a way to override a global lock path based on specific service needs. Change-Id: I373b8905c01ff666b5705bd3bb3c76c3e74a64ab
This commit is contained in:
parent
f79988efca
commit
86ad639f41
@ -62,6 +62,11 @@ 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
|
||||||
|
|
||||||
|
# Global lock path used for system services.
|
||||||
|
# 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".
|
||||||
|
# systemd_lock_path: "/var/lock/service1"
|
||||||
|
|
||||||
# The systemd services dictionary is a set of services that will be created. The dictionary
|
# The systemd services dictionary is a set of services that will be created. The dictionary
|
||||||
# can contain the following options:
|
# can contain the following options:
|
||||||
# `service_name` -- (required) used to define the name of the service. This is typically the name of the executable.
|
# `service_name` -- (required) used to define the name of the service. This is typically the name of the executable.
|
||||||
|
@ -52,13 +52,14 @@
|
|||||||
|
|
||||||
- name: Create TEMP defined lock dir
|
- name: Create TEMP defined lock dir
|
||||||
file:
|
file:
|
||||||
path: "{{ item.systemd_lock_path }}"
|
path: "{{ item.systemd_lock_path | default(systemd_lock_path) }}"
|
||||||
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"
|
||||||
when:
|
when:
|
||||||
- item.systemd_lock_path is defined
|
- (item.systemd_lock_path is defined) or
|
||||||
|
(systemd_lock_path is defined)
|
||||||
with_items: "{{ systemd_services }}"
|
with_items: "{{ systemd_services }}"
|
||||||
tags:
|
tags:
|
||||||
- systemd-service
|
- systemd-service
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
# {{ ansible_managed }}
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
{% if item.systemd_lock_path is defined %}
|
{% if (item.systemd_lock_path is defined) or (systemd_lock_path is defined) %}
|
||||||
D {{ item.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) }}
|
||||||
{% 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/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) }}
|
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