d5262ea5df
First implementation of TOFS for: nginx_config, passenger_config, servers_config and snippets Introduced tplroot on modified files as well Fixed GH link of nginx.conf file in docs/TOFS_pattern.rst Fixed test for snippets name pillar
33 lines
890 B
Plaintext
33 lines
890 B
Plaintext
# nginx.servers
|
|
#
|
|
# Manages virtual hosts and their relationship to the nginx service.
|
|
|
|
{%- 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 %}
|
|
{%- from tplroot ~ '/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 %}
|