nginx-formula/nginx/config.sls
Eric Veiras Galisson 0fc507055d refactor: replace old nginx with nginx.ng
BREAKING CHANGE: all previous `nginx` based configurations must be reviewed;
`nginx.ng` usage must be promoted to `nginx` and any uses of the original
`nginx` will have to be converted.
2019-05-12 17:13:17 +01:00

30 lines
818 B
Plaintext

# nginx.config
#
# Manages the main nginx server configuration file.
{% from 'nginx/map.jinja' import nginx, sls_block 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 %}
{% if 'source_path' in nginx.server.config %}
{% set source_path = nginx.server.config.source_path %}
{% else %}
{% set source_path = 'salt://nginx/files/nginx.conf' %}
{% endif %}
nginx_config:
file.managed:
{{ sls_block(nginx.server.opts) }}
- name: {{ nginx.lookup.conf_file }}
- source: {{ source_path }}
- template: jinja
{% if 'source_path' not in nginx.server.config %}
- context:
config: {{ nginx.server.config|json(sort_keys=False) }}
{% endif %}