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.

31 lines
1.4KB

  1. {# Define default values here so the template below can just focus on layout #}
  2. {%- set sitename = site.get('ServerName', id) -%}
  3. {%- set vals = {
  4. 'interfaces': site.get('interface', '*').split(),
  5. 'port': site.get('port', '80'),
  6. 'ServerName': sitename,
  7. 'ServerAlias': site.get('ServerAlias', 'www.{0}'.format(sitename)),
  8. 'ServerAdmin': site.get('ServerAdmin', 'webmaster@{0}'.format(sitename)),
  9. 'LogLevel': site.get('LogLevel', 'warn'),
  10. 'ErrorLog': site.get('ErrorLog', '{0}/{1}-error.log'.format(map.logdir, sitename)),
  11. 'CustomLog': site.get('CustomLog', '{0}/{1}-access.log'.format(map.logdir, sitename)),
  12. 'DocumentRoot': site.get('DocumentRoot', '{0}/{1}'.format(map.wwwdir, sitename))
  13. } -%}
  14. <VirtualHost {% for intf in vals.interfaces %} {{intf}}:{{ vals.port }}{% endfor -%}>
  15. ServerName {{ vals.ServerName }}
  16. {% if site.get('ServerAlias') != False %}ServerAlias {{ vals.ServerAlias }}{% endif %}
  17. {% if site.get('ServerAdmin') != False %}ServerAdmin {{ vals.ServerAdmin }}{% endif %}
  18. {% if site.get('DocumentRoot') != False -%}DocumentRoot {{ vals.DocumentRoot }}{% endif %}
  19. {% if site.get('LogLevel') != False -%}LogLevel {{ vals.LogLevel }}{% endif %}
  20. {% if site.get('ErrorLog') != False -%}ErrorLog {{ vals.ErrorLog }}{% endif %}
  21. {% if site.get('CustomLog') != False -%}CustomLog {{ vals.CustomLog }} {{ vals.LogFormat }}{% endif %}
  22. </VirtualHost>