2014-05-16 00:06:48 +02:00
|
|
|
# nginx.ng.service
|
|
|
|
#
|
|
|
|
# Manages the nginx service.
|
2014-05-19 19:22:51 +02:00
|
|
|
|
2014-05-16 00:06:48 +02:00
|
|
|
{% from 'nginx/ng/map.jinja' import nginx, sls_block with context %}
|
|
|
|
{% set service_function = {True:'running', False:'dead'}.get(nginx.service.enable) %}
|
|
|
|
|
|
|
|
include:
|
2016-05-10 13:00:18 +02:00
|
|
|
{% if nginx.install_from_source %}
|
|
|
|
- nginx.ng.src
|
|
|
|
{% else %}
|
|
|
|
- nginx.ng.pkg
|
|
|
|
{% endif %}
|
2016-05-09 17:31:29 +02:00
|
|
|
|
|
|
|
{% if nginx.install_from_source %}
|
2016-05-10 13:00:18 +02:00
|
|
|
nginx_systemd_service_file:
|
2016-05-09 17:31:29 +02:00
|
|
|
file.managed:
|
2016-05-10 13:00:18 +02:00
|
|
|
- name: /lib/systemd/system/nginx.service
|
2016-05-09 17:31:29 +02:00
|
|
|
- source: salt://nginx/ng/files/nginx.service
|
|
|
|
{% endif %}
|
2014-05-16 00:06:48 +02:00
|
|
|
|
|
|
|
nginx_service:
|
|
|
|
service.{{ service_function }}:
|
|
|
|
{{ sls_block(nginx.service.opts) }}
|
|
|
|
- name: {{ nginx.lookup.service }}
|
|
|
|
- enable: {{ nginx.service.enable }}
|
|
|
|
- require:
|
2016-05-10 13:00:18 +02:00
|
|
|
{% if nginx.install_from_source %}
|
|
|
|
- sls: nginx.ng.src
|
|
|
|
{% else %}
|
|
|
|
- sls: nginx.ng.pkg
|
|
|
|
{% endif %}
|
2016-10-29 09:34:28 +02:00
|
|
|
- listen:
|
2016-05-09 17:31:29 +02:00
|
|
|
{% if nginx.install_from_source %}
|
|
|
|
- cmd: nginx_install
|
|
|
|
{% else %}
|
2014-05-16 00:06:48 +02:00
|
|
|
- pkg: nginx_install
|
|
|
|
{% endif %}
|