2019-05-10 23:07:18 +02:00
|
|
|
# nginx.service
|
2014-05-16 00:06:48 +02:00
|
|
|
#
|
|
|
|
# Manages the nginx service.
|
2014-05-19 19:22:51 +02:00
|
|
|
|
2019-05-10 23:07:18 +02:00
|
|
|
{% from 'nginx/map.jinja' import nginx, sls_block with context %}
|
2014-05-16 00:06:48 +02:00
|
|
|
{% 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 %}
|
2019-05-10 23:07:18 +02:00
|
|
|
- nginx.src
|
2016-05-10 13:00:18 +02:00
|
|
|
{% else %}
|
2019-05-10 23:07:18 +02:00
|
|
|
- nginx.pkg
|
2016-05-10 13:00:18 +02:00
|
|
|
{% 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
|
2019-05-10 23:07:18 +02:00
|
|
|
- source: salt://nginx/files/nginx.service
|
2017-12-12 21:10:51 +01:00
|
|
|
{% 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 %}
|
2019-05-10 23:07:18 +02:00
|
|
|
- sls: nginx.src
|
2016-05-10 13:00:18 +02:00
|
|
|
{% else %}
|
2019-05-10 23:07:18 +02:00
|
|
|
- sls: nginx.pkg
|
2016-05-10 13:00:18 +02:00
|
|
|
{% 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 %}
|