openstack-ansible-os_ironic/templates/ironic-upstart-init.j2
2015-11-30 20:21:46 +10:30

49 lines
1.3 KiB
Django/Jinja

# {{ ansible_managed }}
# vim:set ft=upstart ts=2 et:
description "{{ program_name }}"
author "Michael Davies <michael@the-davies.net>"
start on runlevel [2345]
stop on runlevel [016]
respawn
respawn limit 10 5
# Set the RUNBIN environment variable
env RUNBIN="{{ ironic_bin }}/{{ program_name }}"
env RUNOPTS="--config-file /etc/ironic/ironic.conf"
# Change directory to service users home
chdir "{{ service_home }}"
# Pre start actions
pre-start script
mkdir -p "/var/run/{{ program_name }}"
chown {{ system_user }}:{{ system_group }} "/var/run/{{ program_name }}"
mkdir -p "/var/lock/{{ program_name }}"
chown {{ system_user }}:{{ system_group }} "/var/lock/{{ program_name }}"
{% if ironic_venv_enabled | bool -%}
. {{ ironic_venv_bin }}/activate
{%- endif %}
end script
# Post stop actions
post-stop script
rm "/var/run/{{ program_name }}/{{ program_name }}.pid"
end script
# Run the start up job
exec start-stop-daemon --start \
--chuid {{ system_user }} \
--make-pidfile \
--pidfile /var/run/{{ program_name }}/{{ program_name }}.pid \
--exec "{{ program_override|default('$RUNBIN') }}" \
-- {{ program_config_options|default('$RUNOPTS') }} \
--log-file={{ ironic_system_log_folder }}/{{ program_name }}.log