Saltstack Official Apache 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.

49 lines
1.6KB

  1. #
  2. # This file is managed by Salt! Do not edit by hand!
  3. #
  4. {%- from "apache/map.jinja" import apache with context -%}
  5. {% if salt['pillar.get']('apache:sites') is mapping %}
  6. {%- set listen_directives = [] %}
  7. {%- for id, site in salt['pillar.get']('apache:sites').items() %}
  8. {%- set interfaces = site.get('interface', '*').split() %}
  9. {%- set port = site.get('port', 80) %}
  10. {%- for interface in interfaces %}
  11. {%- if not site.get('exclude_listen_directive', False) %}
  12. {%- set listen_directive = interface ~ ':' ~ port %}
  13. {%- if listen_directive not in listen_directives %}
  14. {%- do listen_directives.append(listen_directive) %}
  15. {%- endif %}
  16. {%- endif %}
  17. {%- endfor %}
  18. {%- endfor %}
  19. {%- for listen in listen_directives %}
  20. Listen {{ listen }}
  21. {%- endfor %}
  22. {%- else %}
  23. Listen 80
  24. <IfModule mod_ssl.c>
  25. Listen 443
  26. </IfModule>
  27. <IfModule mod_gnutls.c>
  28. Listen 443
  29. </IfModule>
  30. {%- endif %}
  31. {%- if salt['pillar.get']('apache:name_virtual_hosts') is iterable %}
  32. {%- set name_virtual_host_directives = [] %}
  33. {%- for name_virtual_host in salt['pillar.get']('apache:name_virtual_hosts') %}
  34. {%- set interface = name_virtual_host.get('interface', '*') %}
  35. {%- set port = name_virtual_host.get('port', 80) %}
  36. {%- set name_virtual_host_directive = interface ~ ':' ~ port %}
  37. {%- do name_virtual_host_directives.append(name_virtual_host_directive) %}
  38. {%- endfor %}
  39. {%- for name_virtual_host in name_virtual_host_directives %}
  40. NameVirtualHost {{ name_virtual_host }}
  41. {%- endfor %}
  42. {%- endif -%}