nginx-formula/nginx/servers.sls
Eric Veiras Galisson 0fc507055d refactor: replace old nginx with nginx.ng
BREAKING CHANGE: all previous `nginx` based configurations must be reviewed;
`nginx.ng` usage must be promoted to `nginx` and any uses of the original
`nginx` will have to be converted.
2019-05-12 17:13:17 +01:00

32 lines
830 B
Plaintext

# nginx.servers
#
# Manages virtual hosts and their relationship to the nginx service.
{% from 'nginx/map.jinja' import nginx, sls_block with context %}
{% from 'nginx/servers_config.sls' import server_states with context %}
{% from 'nginx/service.sls' import service_function with context %}
{% macro file_requisites(states) %}
{%- for state in states %}
- file: {{ state }}
{%- endfor -%}
{% endmacro %}
include:
- nginx.service
- nginx.servers_config
{% if server_states|length() > 0 %}
nginx_service_reload:
service.{{ service_function }}:
- name: {{ nginx.lookup.service }}
- reload: True
- use:
- service: nginx_service
- listen:
{{ file_requisites(server_states) }}
- require:
{{ file_requisites(server_states) }}
- service: nginx_service
{% endif %}