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.

34 line
952B

  1. # nginx.config
  2. #
  3. # Manages the main nginx server configuration file.
  4. {%- set tplroot = tpldir.split('/')[0] %}
  5. {%- from tplroot ~ '/map.jinja' import nginx, sls_block with context %}
  6. {%- from tplroot ~ '/libtofs.jinja' import files_switch with context %}
  7. {% if nginx.install_from_source %}
  8. nginx_log_dir:
  9. file.directory:
  10. - name: /var/log/nginx
  11. - user: {{ nginx.server.config.user }}
  12. - group: {{ nginx.server.config.user }}
  13. {% endif %}
  14. nginx_config:
  15. file.managed:
  16. {{ sls_block(nginx.server.opts) }}
  17. - name: {{ nginx.lookup.conf_file }}
  18. - source:
  19. {% if 'source_path' in nginx.server.config %}
  20. - {{ nginx.server.config.source_path }}
  21. {% endif %}
  22. {{ files_switch(['nginx.conf'],
  23. 'nginx_config_file_managed'
  24. )
  25. }}
  26. - template: jinja
  27. {% if 'source_path' not in nginx.server.config %}
  28. - context:
  29. config: {{ nginx.server.config|json(sort_keys=False) }}
  30. {% endif %}