nginx-formula/nginx/config.sls

30 lines
818 B
Plaintext
Raw Normal View History

# nginx.config
2014-05-19 19:22:51 +02:00
#
# Manages the main nginx server configuration file.
{% from 'nginx/map.jinja' import nginx, sls_block with context %}
2014-05-16 00:06:48 +02:00
2016-05-09 18:59:55 +02:00
{% if nginx.install_from_source %}
nginx_log_dir:
file.directory:
- name: /var/log/nginx
- user: {{ nginx.server.config.user }}
- group: {{ nginx.server.config.user }}
2016-05-09 18:59:55 +02:00
{% endif %}
{% if 'source_path' in nginx.server.config %}
{% set source_path = nginx.server.config.source_path %}
2017-12-12 21:10:51 +01:00
{% else %}
{% set source_path = 'salt://nginx/files/nginx.conf' %}
{% endif %}
2014-05-16 00:06:48 +02:00
nginx_config:
file.managed:
{{ sls_block(nginx.server.opts) }}
- name: {{ nginx.lookup.conf_file }}
- source: {{ source_path }}
2014-05-16 00:06:48 +02:00
- template: jinja
{% if 'source_path' not in nginx.server.config %}
2014-05-16 00:06:48 +02:00
- context:
config: {{ nginx.server.config|json(sort_keys=False) }}
{% endif %}