Allow services to provide after_targets directly

Add 'after_targets' as its own key inside a systemd services dictionary
instead of using config_template overrides.

Change-Id: I8d2ae74010c040544b8099f596678acd71e727e9
This commit is contained in:
Jimmy McCrory 2018-11-02 06:26:49 -07:00
parent 520465f895
commit a5e3dee6fa
2 changed files with 5 additions and 3 deletions

View File

@ -42,7 +42,7 @@ systemd_PrivateUsers: false
# Start service after a given target. This is here because we want to define common
# after targets used on most services. This can be overridden or agumented using
# the "systemd_services" dictionary option "config_overrides".
# the "systemd_services" dictionary option "after_targets".
systemd_after_targets:
- syslog.target
- network.target
@ -68,6 +68,7 @@ systemd_default_service_type: simple
# `service_type` -- (optional) Set the service type, default is "simple".
# `execstarts` -- (required) Set the program to start, when the service is simple the list has a max length of 1.
# `execstops` -- (optional) Set the program to stop, when the service is simple the list has a max length of 1.
# `after_targets` -- (optional) Start the service after this list of dependency units.
# `config_overrides` -- (optional) This allows any section or key=value pair to be set within the systemd unit file.
# `program_sandboxing` -- (optional) Case sensitive Key=Value pairs for service Sandboxing
# `program_accounting` -- (optional) Case sensitive Key=Value pairs for service Accounting

View File

@ -2,8 +2,9 @@
[Unit]
Description={{ item.service_name }} service
{% for item in systemd_after_targets %}
After={{ item }}
{% set after_targets = item.after_targets | default(systemd_after_targets) %}
{% for target in after_targets %}
After={{ target }}
{% endfor %}
{% for item in systemd_unit_docs %}
Documentation={{ item }}