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.

26 lines
770B

  1. # nginx.snippet
  2. #
  3. # Manages creation of snippets
  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. nginx_snippets_dir:
  8. file.directory:
  9. {{ sls_block(nginx.servers.dir_opts) }}
  10. - name: {{ nginx.lookup.snippets_dir }}
  11. {% for snippet, config in nginx.snippets.items() %}
  12. nginx_snippet_{{ snippet }}:
  13. file.managed:
  14. - name: {{ nginx.lookup.snippets_dir ~ '/' ~ snippet ~ '.conf' }}
  15. - source: {{ files_switch([ snippet, 'server.conf' ],
  16. 'nginx_snippet_file_managed'
  17. )
  18. }}
  19. - template: jinja
  20. - context:
  21. config: {{ config|json() }}
  22. {% endfor %}