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.

преди 11 години
преди 11 години
преди 6 години
преди 11 години
преди 9 години
преди 11 години
преди 11 години
преди 11 години
преди 9 години
преди 11 години
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. {% set documentroot = site.get('DocumentRoot', '{0}/{1}'.format(apache.wwwdir, site.get('ServerName', id))) %}
  6. apache_vhosts_{{ id }}:
  7. file.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. {% if site.get('DocumentRoot') != False %}
  20. {{ id }}-documentroot:
  21. file.directory:
  22. - name: {{ documentroot }}
  23. - makedirs: True
  24. - user: {{ site.get('DocumentRootUser', apache.get('document_root_user'))|json }}
  25. - group: {{ site.get('DocumentRootGroup', apache.get('document_root_group'))|json }}
  26. - allow_symlink: True
  27. {% endif %}
  28. {% if grains.os_family == 'Debian' %}
  29. {% if site.get('enabled', True) %}
  30. a2ensite {{ id }}{{ apache.confext }}:
  31. cmd.run:
  32. - unless: test -f /etc/apache2/sites-enabled/{{ id }}{{ apache.confext }}
  33. - require:
  34. - file: /etc/apache2/sites-available/{{ id }}{{ apache.confext }}
  35. - watch_in:
  36. - module: apache-reload
  37. {% else %}
  38. a2dissite {{ id }}{{ apache.confext }}:
  39. cmd.run:
  40. - onlyif: test -f /etc/apache2/sites-enabled/{{ id }}{{ apache.confext }}
  41. - require:
  42. - file: /etc/apache2/sites-available/{{ id }}{{ apache.confext }}
  43. - watch_in:
  44. - module: apache-reload
  45. {% endif %}
  46. {% endif %}
  47. {% endfor %}