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.

58 lines
1.4KB

  1. {% from "apache/map.jinja" import apache with context %}
  2. {% set mpm_module = salt['pillar.get']('apache:mpm:module', 'mpm_prefork') %}
  3. {% if grains['os_family']=="Debian" %}
  4. include:
  5. - apache
  6. a2enmod {{ mpm_module }}:
  7. cmd.run:
  8. - unless: ls /etc/apache2/mods-enabled/{{ mpm_module }}.load
  9. - require:
  10. - pkg: apache
  11. - watch_in:
  12. - module: apache-restart
  13. file.managed:
  14. - name: /etc/apache2/mods-available/{{ mpm_module }}.conf
  15. - template: jinja
  16. - source:
  17. - salt://apache/files/Debian/mpm/{{ mpm_module }}.conf.jinja
  18. - require:
  19. - pkg: apache
  20. - watch_in:
  21. - module: apache-restart
  22. # Deactivate the other mpm modules as a previous step
  23. {% for mod in ['mpm_prefork', 'mpm_worker', 'mpm_event'] if not mod == mpm_module %}
  24. a2dismod {{ mod }}:
  25. cmd.run:
  26. - onlyif: test -e /etc/apache2/mods-enabled/{{ mod }}.load
  27. - require:
  28. - pkg: apache
  29. - require_in:
  30. - cmd: a2enmod {{ mpm_module }}
  31. - watch_in:
  32. - module: apache-restart
  33. {% endfor %}
  34. {% endif %}
  35. {% if grains['os_family']=="RedHat" %}
  36. include:
  37. - apache
  38. {{ apache.moddir }}/00-mpm-conf.conf:
  39. file.managed:
  40. - name: {{ apache.moddir }}/00-mpm.conf
  41. - template: jinja
  42. - source:
  43. - salt://apache/files/RedHat/conf.modules.d/00-mpm.conf.jinja
  44. - require:
  45. - pkg: httpd
  46. - watch_in:
  47. - module: apache-restart
  48. {% endif %}