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.

39 lines
1.0KB

  1. {% if grains['os_family']=="Debian" %}
  2. {% from "apache/map.jinja" import apache with context %}
  3. {% set mpm_module = salt['pillar.get']('apache:mpm:module', 'mpm_prefork') %}
  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 %}