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.

38 lines
1.6KB

  1. #
  2. # This file is managed by Salt! Do not edit by hand!
  3. #
  4. {# Define default values here so the template below can just focus on layout #}
  5. {%- set sitename = site.get('ServerName', id) -%}
  6. {%- set vals = {
  7. 'interfaces': site.get('interface', '*').split(),
  8. 'port': site.get('port', '80'),
  9. 'ServerName': sitename,
  10. 'ServerAlias': site.get('ServerAlias', ''),
  11. 'ServerAdmin': site.get('ServerAdmin', 'webmaster@{0}'.format(sitename)),
  12. 'LogLevel': site.get('LogLevel', 'warn'),
  13. 'ErrorLog': site.get('ErrorLog', '{0}/{1}-error.log'.format(map.logdir, sitename)),
  14. 'CustomLog': site.get('CustomLog', '{0}/{1}-access.log'.format(map.logdir, sitename)),
  15. 'LogFormat': site.get('LogFormat', '"%h %l %u %t \\\"%r\\\" %>s %b"'),
  16. 'DocumentRoot': site.get('DocumentRoot', '{0}/{1}'.format(map.wwwdir, sitename))
  17. } -%}
  18. <VirtualHost {% for intf in vals.interfaces %} {{ intf }}:{{ vals.port }}{% endfor -%}>
  19. ServerName {{ vals.ServerName }}
  20. {% if site.get('ServerAlias') != False %}ServerAlias {{ vals.ServerAlias }}{% endif %}
  21. {% if site.get('ServerAdmin') != False %}ServerAdmin {{ vals.ServerAdmin }}{% endif %}
  22. {% if site.get('DocumentRoot') != False -%}DocumentRoot {{ vals.DocumentRoot }}{% endif %}
  23. {% if site.get('LogLevel') != False -%}LogLevel {{ vals.LogLevel }}{% endif %}
  24. {% if site.get('ErrorLog') != False -%}ErrorLog {{ vals.ErrorLog }}{% endif %}
  25. {% if site.get('LogFormat') != False -%}LogFormat {{ vals.LogFormat }}{% endif %}
  26. {% if site.get('CustomLog') != False -%}LogFormat {{ vals.LogFormat }} {{ sitename }}
  27. CustomLog {{ vals.CustomLog }} {{ sitename }}{% endif %}
  28. </VirtualHost>