# {{ ansible_managed }} description "{{ item.value.program_name }}" author "Kevin Carter " start on runlevel [2345] stop on runlevel [016] respawn respawn limit 10 5 # Set the RUNBIN environment variable env RUNBIN="{{ swift_bin }}/{{ item.value.program_binary | default(item.value.program_name) }}" # Change directory to service users home chdir "{{ swift_system_home_folder }}" # Pre start actions pre-start script mkdir -p "/var/run/{{ item.value.program_binary | default(item.value.program_name) }}" chown {{ swift_system_user_name }}:{{ swift_system_group_name }} "/var/run/{{ item.value.program_binary | default(item.value.program_name) }}" mkdir -p "/var/lock/{{ item.value.program_binary | default(item.value.program_name) }}" chown {{ swift_system_user_name }}:{{ swift_system_group_name }} "/var/lock/{{ item.value.program_binary | default(item.value.program_name) }}" . {{ swift_bin }}/activate end script # Post stop actions post-stop script rm "/var/run/{{ item.value.program_binary | default(item.value.program_name) }}/{{ item.value.program_name }}.pid" end script # Run the start up job exec start-stop-daemon --start \ --chuid {{ swift_system_user_name }} \ --make-pidfile \ --pidfile /var/run/{{ item.value.program_binary | default(item.value.program_name) }}/{{ item.value.program_name }}.pid \ --exec "{{ item.value.program_override|default('$RUNBIN') }}" "{{ item.value.program_config_options|default('') }}"