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 lines
1021B

  1. # nginx.streams
  2. #
  3. # Manages creation of streams
  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 is a lightened copy of nginx map intended to passed in templates #}
  8. {%- set _nginx = nginx.copy() %}
  9. {%- do _nginx.pop('streams') if nginx.snippets is defined %}
  10. {%- do _nginx.pop('servers') if nginx.servers is defined %}
  11. nginx_streams_dir:
  12. file.directory:
  13. {{ sls_block(nginx.servers.dir_opts) }}
  14. - name: {{ nginx.lookup.streams_dir }}
  15. {% for stream, config in nginx.streams.items() %}
  16. nginx_streams_{{ stream }}:
  17. file.managed:
  18. - name: {{ nginx.lookup.streams_dir ~ '/' ~ stream }}
  19. - source: {{ files_switch([ stream, 'server.conf' ],
  20. 'nginx_stream_file_managed'
  21. )
  22. }}
  23. - template: jinja
  24. - context:
  25. config: {{ config|json() }}
  26. nginx: {{ _nginx|json() }}
  27. {% endfor %}