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
34 lines
952 B
Plaintext
34 lines
952 B
Plaintext
# nginx.config
|
|
#
|
|
# Manages the main nginx server configuration file.
|
|
|
|
{%- set tplroot = tpldir.split('/')[0] %}
|
|
{%- from tplroot ~ '/map.jinja' import nginx, sls_block with context %}
|
|
{%- from tplroot ~ '/libtofs.jinja' import files_switch with context %}
|
|
|
|
{% if nginx.install_from_source %}
|
|
nginx_log_dir:
|
|
file.directory:
|
|
- name: /var/log/nginx
|
|
- user: {{ nginx.server.config.user }}
|
|
- group: {{ nginx.server.config.user }}
|
|
{% endif %}
|
|
|
|
nginx_config:
|
|
file.managed:
|
|
{{ sls_block(nginx.server.opts) }}
|
|
- name: {{ nginx.lookup.conf_file }}
|
|
- source:
|
|
{% if 'source_path' in nginx.server.config %}
|
|
- {{ nginx.server.config.source_path }}
|
|
{% endif %}
|
|
{{ files_switch(['nginx.conf'],
|
|
'nginx_config_file_managed'
|
|
)
|
|
}}
|
|
- template: jinja
|
|
{% if 'source_path' not in nginx.server.config %}
|
|
- context:
|
|
config: {{ nginx.server.config|json(sort_keys=False) }}
|
|
{% endif %}
|