2019-05-10 23:07:18 +02:00
|
|
|
# nginx.config
|
2014-05-19 19:22:51 +02:00
|
|
|
#
|
|
|
|
# Manages the main nginx server configuration file.
|
|
|
|
|
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 ~ '/libtofs.jinja' import files_switch with context %}
|
2014-05-16 00:06:48 +02:00
|
|
|
|
2016-05-09 18:59:55 +02:00
|
|
|
{% if nginx.install_from_source %}
|
2016-05-10 13:06:42 +02:00
|
|
|
nginx_log_dir:
|
2016-05-10 13:00:18 +02:00
|
|
|
file.directory:
|
|
|
|
- name: /var/log/nginx
|
2016-05-10 13:06:42 +02:00
|
|
|
- user: {{ nginx.server.config.user }}
|
|
|
|
- group: {{ nginx.server.config.user }}
|
2016-05-09 18:59:55 +02:00
|
|
|
{% endif %}
|
|
|
|
|
2014-05-16 00:06:48 +02:00
|
|
|
nginx_config:
|
|
|
|
file.managed:
|
|
|
|
{{ sls_block(nginx.server.opts) }}
|
|
|
|
- name: {{ nginx.lookup.conf_file }}
|
2019-05-16 08:27:21 +02:00
|
|
|
- source:
|
|
|
|
{% if 'source_path' in nginx.server.config %}
|
|
|
|
- {{ nginx.server.config.source_path }}
|
|
|
|
{% endif %}
|
|
|
|
{{ files_switch(['nginx.conf'],
|
|
|
|
'nginx_config_file_managed'
|
|
|
|
)
|
|
|
|
}}
|
2014-05-16 00:06:48 +02:00
|
|
|
- template: jinja
|
2017-08-31 13:22:55 +02:00
|
|
|
{% if 'source_path' not in nginx.server.config %}
|
2014-05-16 00:06:48 +02:00
|
|
|
- context:
|
2017-03-23 18:54:16 +01:00
|
|
|
config: {{ nginx.server.config|json(sort_keys=False) }}
|
2017-08-30 19:48:44 +02:00
|
|
|
{% endif %}
|