Saltstack Official Nginx Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
812B

  1. # nginx.ng.config
  2. #
  3. # Manages the main nginx server configuration file.
  4. {% from 'nginx/ng/map.jinja' import nginx, sls_block with context %}
  5. {% if nginx.install_from_source %}
  6. nginx_log_dir:
  7. file.directory:
  8. - name: /var/log/nginx
  9. - user: {{ nginx.server.config.user }}
  10. - group: {{ nginx.server.config.user }}
  11. {% endif %}
  12. {% if 'source_path' in nginx.server.config %}
  13. {% set source_path = nginx.server.config.source_path %}
  14. {% else %}
  15. {% set source_path = 'salt://nginx/ng/files/nginx.conf' %}
  16. {% endif %}
  17. nginx_config:
  18. file.managed:
  19. {{ sls_block(nginx.server.opts) }}
  20. - name: {{ nginx.lookup.conf_file }}
  21. - source: {{ source_path }}
  22. - template: jinja
  23. {% if 'source_path' not in nginx.server.config %}
  24. - context:
  25. config: {{ nginx.server.config|json() }}
  26. {% endif %}