2019-05-10 23:07:18 +02:00
|
|
|
# nginx.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
|
|
|
|
2019-05-16 08:27:21 +02:00
|
|
|
{%- set tplroot = tpldir.split('/')[0] %}
|
|
|
|
{%- from tplroot ~ '/map.jinja' import nginx, sls_block with context %}
|
|
|
|
{%- from tplroot ~ '/servers_config.sls' import server_states with context %}
|
2014-05-16 00:06:48 +02:00
|
|
|
|
2014-05-21 06:50:50 +02:00
|
|
|
{% macro file_requisites(states) %}
|
2021-03-13 21:54:07 +01:00
|
|
|
{%- for state in states %}
|
|
|
|
- file: {{ state }}
|
|
|
|
{%- endfor -%}
|
2014-05-21 06:50:50 +02:00
|
|
|
{% endmacro %}
|
|
|
|
|
2014-05-16 00:06:48 +02:00
|
|
|
include:
|
2019-05-10 23:07:18 +02:00
|
|
|
- nginx.service
|
|
|
|
- nginx.servers_config
|
2014-05-16 00:06:48 +02:00
|
|
|
|
2016-10-19 23:35:38 +02:00
|
|
|
{% if server_states|length() > 0 %}
|
2021-03-13 21:54:07 +01:00
|
|
|
extend:
|
|
|
|
nginx_service:
|
|
|
|
service:
|
|
|
|
- reload: True
|
|
|
|
- require:
|
|
|
|
{{ file_requisites(server_states) }}
|
|
|
|
- listen:
|
|
|
|
{{ file_requisites(server_states) }}
|
2014-05-16 00:06:48 +02:00
|
|
|
{% endif %}
|