add more options

Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter 2018-03-08 20:32:52 -06:00
parent 9a4ed2d7bc
commit 00fd8cfc70
No known key found for this signature in database
GPG Key ID: 9443251A787B9FB3
2 changed files with 29 additions and 7 deletions

View File

@ -81,10 +81,18 @@ systemd_service_config_overrides: {}
# service_name: ServiceY
# init_config_overrides: {} # This is used to add in arbitratry unit file options
# program_override: '/usr/bin/ServiceY'
# program_stop: '/usr/bin/stopcmd'
# ServiceZ:
# service_name: ServiceZ
# init_config_overrides: {} # This is used to add in arbitratry unit file options
# enabled: no
# state: stopped
# service_type: oneshot
# program_execstarts:
# - /usr/bin/startcmd1
# - /usr/bin/startcmd2
# program_execstops
# - /usr/bin/stopcmd1
# - /usr/bin/stopcmd2
systemd_services: {}

View File

@ -7,20 +7,34 @@ After={{ item }}
{% endfor %}
[Service]
Type={{ item.service_type | default('simple') }}
{% set service_type = item.service_type | default('simple') %}
Type={{ service_type }}
User={{ systemd_user_name }}
Group={{ systemd_group_name }}
{% if item.program_override is defined %}
{% if service_type == 'oneshot' and item.program_execstarts is defined %}
{% for execstart in item.program_execstarts %}
ExecStart={{ execstart }}
{% endfor %}
{% if item.program_execstops is defined %}
{% for execstop in item.program_execstops %}
ExecStop={{ execstop }}
{% endfor %}
{% endif %}
{% else %}
{% if item.program_override is defined %}
ExecStart={{ item.program_override }} {{ item.program_config_options | default('') }}
{% else %}
{% else %}
ExecStart={{ systemd_bin_path }}/{{ item.service_name }} {{ item.program_config_options | default('') }}
{% endif %}
{% if item.program_reload is defined %}
{% endif %}
{% if item.program_reload is defined %}
ExecReload={{ item.program_reload }}
{% else %}
{% else %}
ExecReload=/bin/kill -HUP $MAINPID
{% endif %}
{% if item.program_stop is defined %}
ExecStop={{ item.program_stop }}
{% endif %}
{% endif %}
# Give a reasonable amount of time for the server to start up/shut down