add more options
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
parent
9a4ed2d7bc
commit
00fd8cfc70
@ -81,10 +81,18 @@ systemd_service_config_overrides: {}
|
|||||||
# service_name: ServiceY
|
# service_name: ServiceY
|
||||||
# init_config_overrides: {} # This is used to add in arbitratry unit file options
|
# init_config_overrides: {} # This is used to add in arbitratry unit file options
|
||||||
# program_override: '/usr/bin/ServiceY'
|
# program_override: '/usr/bin/ServiceY'
|
||||||
|
# program_stop: '/usr/bin/stopcmd'
|
||||||
# ServiceZ:
|
# ServiceZ:
|
||||||
# service_name: ServiceZ
|
# service_name: ServiceZ
|
||||||
# init_config_overrides: {} # This is used to add in arbitratry unit file options
|
# init_config_overrides: {} # This is used to add in arbitratry unit file options
|
||||||
# enabled: no
|
# enabled: no
|
||||||
# state: stopped
|
# state: stopped
|
||||||
|
# service_type: oneshot
|
||||||
|
# program_execstarts:
|
||||||
|
# - /usr/bin/startcmd1
|
||||||
|
# - /usr/bin/startcmd2
|
||||||
|
# program_execstops
|
||||||
|
# - /usr/bin/stopcmd1
|
||||||
|
# - /usr/bin/stopcmd2
|
||||||
|
|
||||||
systemd_services: {}
|
systemd_services: {}
|
||||||
|
@ -7,21 +7,35 @@ After={{ item }}
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type={{ item.service_type | default('simple') }}
|
{% set service_type = item.service_type | default('simple') %}
|
||||||
|
Type={{ service_type }}
|
||||||
User={{ systemd_user_name }}
|
User={{ systemd_user_name }}
|
||||||
Group={{ systemd_group_name }}
|
Group={{ systemd_group_name }}
|
||||||
|
|
||||||
|
{% 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 %}
|
{% if item.program_override is defined %}
|
||||||
ExecStart={{ item.program_override }} {{ item.program_config_options | default('') }}
|
ExecStart={{ item.program_override }} {{ item.program_config_options | default('') }}
|
||||||
{% else %}
|
{% else %}
|
||||||
ExecStart={{ systemd_bin_path }}/{{ item.service_name }} {{ item.program_config_options | default('') }}
|
ExecStart={{ systemd_bin_path }}/{{ item.service_name }} {{ item.program_config_options | default('') }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if item.program_reload is defined %}
|
{% if item.program_reload is defined %}
|
||||||
ExecReload={{ item.program_reload }}
|
ExecReload={{ item.program_reload }}
|
||||||
{% else %}
|
{% else %}
|
||||||
ExecReload=/bin/kill -HUP $MAINPID
|
ExecReload=/bin/kill -HUP $MAINPID
|
||||||
{% endif %}
|
{% 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
|
# Give a reasonable amount of time for the server to start up/shut down
|
||||||
TimeoutSec={{ systemd_TimeoutSec }}
|
TimeoutSec={{ systemd_TimeoutSec }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user