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.

mod_mpm.sls 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. - require_in:
  14. - module: apache-restart
  15. - module: apache-reload
  16. - service: apache
  17. file.managed:
  18. - name: /etc/apache2/mods-available/{{ mpm_module }}.conf
  19. - template: jinja
  20. - source:
  21. - salt://apache/files/Debian/mpm/{{ mpm_module }}.conf.jinja
  22. - require:
  23. - pkg: apache
  24. - watch_in:
  25. - module: apache-restart
  26. - require_in:
  27. - module: apache-restart
  28. - module: apache-reload
  29. - service: apache
  30. # Deactivate the other mpm modules as a previous step
  31. {% for mod in ['mpm_prefork', 'mpm_worker', 'mpm_event'] if not mod == mpm_module %}
  32. a2dismod {{ mod }}:
  33. cmd.run:
  34. - onlyif: test -e /etc/apache2/mods-enabled/{{ mod }}.load
  35. - require:
  36. - pkg: apache
  37. - require_in:
  38. - cmd: a2enmod {{ mpm_module }}
  39. - watch_in:
  40. - module: apache-restart
  41. - require_in:
  42. - module: apache-restart
  43. - module: apache-reload
  44. - service: apache
  45. {% endfor %}
  46. {% endif %}
  47. {% if grains['os_family']=="RedHat" %}
  48. include:
  49. - apache
  50. {{ apache.moddir }}/00-mpm-conf.conf:
  51. file.managed:
  52. - name: {{ apache.moddir }}/00-mpm.conf
  53. - template: jinja
  54. - source:
  55. - salt://apache/files/RedHat/conf.modules.d/00-mpm.conf.jinja
  56. - require:
  57. - pkg: httpd
  58. - watch_in:
  59. - module: apache-restart
  60. - require_in:
  61. - module: apache-restart
  62. - module: apache-reload
  63. - service: apache
  64. {% endif %}