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.

41 lines
1.0KB

  1. {% from "apache/map.jinja" import apache with context %}
  2. include:
  3. - apache
  4. {% for id, site in salt['pillar.get']('apache:sites', {}).items() %}
  5. {{ id }}:
  6. file:
  7. - managed
  8. - name: {{ apache.vhostdir }}/{{ id }}{{ apache.confext }}
  9. - source: {{ site.get('template_file', 'salt://apache/vhosts/standard.tmpl') }}
  10. - template: {{ site.get('template_engine', 'jinja') }}
  11. - context:
  12. id: {{ id|json }}
  13. site: {{ site|json }}
  14. map: {{ apache|json }}
  15. - require:
  16. - pkg: apache
  17. - watch_in:
  18. - module: apache-reload
  19. {{ id }}-documentroot:
  20. file.directory:
  21. - unless: test -d {{ site.get('DocumentRoot') }}
  22. - name: {{ site.get('DocumentRoot') }}
  23. - makedirs: True
  24. {% if grains.os_family == 'Debian' %}
  25. a2ensite {{ id }}{{ apache.confext }}:
  26. cmd:
  27. - run
  28. - unless: test -f /etc/apache2/sites-enabled/{{ id }}{{ apache.confext }}
  29. - require:
  30. - file: /etc/apache2/sites-available/{{ id }}{{ apache.confext }}
  31. - watch_in:
  32. - module: apache-reload
  33. {% endif %}
  34. {% endfor %}