nginx-formula/nginx/ng/servers.sls

32 lines
848 B
Plaintext
Raw Normal View History

# nginx.ng.servers
2014-05-16 00:06:48 +02:00
#
# Manages virtual hosts and their relationship to 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 %}
{% from 'nginx/ng/servers_config.sls' import server_states with context %}
2014-05-16 00:06:48 +02:00
{% from 'nginx/ng/service.sls' import service_function with context %}
2014-05-21 06:50:50 +02:00
{% macro file_requisites(states) %}
{%- for state in states %}
- file: {{ state }}
{%- endfor -%}
{% endmacro %}
2014-05-16 00:06:48 +02:00
include:
- nginx.ng.service
- nginx.ng.servers_config
2014-05-16 00:06:48 +02:00
{% if server_states|length() > 0 %}
2014-05-16 00:06:48 +02:00
nginx_service_reload:
service.{{ service_function }}:
- name: {{ nginx.lookup.service }}
- reload: True
- use:
- service: nginx_service
- listen:
{{ file_requisites(server_states) }}
2014-05-21 06:50:50 +02:00
- require:
{{ file_requisites(server_states) }}
2014-05-21 06:50:50 +02:00
- service: nginx_service
2014-05-16 00:06:48 +02:00
{% endif %}