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.

56 lines
1.3KB

  1. {% from "apache/map.jinja" import apache with context %}
  2. include:
  3. - apache
  4. mod-php5:
  5. pkg.installed:
  6. - name: {{ apache.mod_php5 }}
  7. - order: 180
  8. - require:
  9. - pkg: apache
  10. {% if grains['os_family']=="Debian" %}
  11. a2enmod php5:
  12. cmd.run:
  13. - unless: ls /etc/apache2/mods-enabled/php5.load
  14. - order: 225
  15. - require:
  16. - pkg: mod-php5
  17. - watch_in:
  18. - module: apache-restart
  19. {% if 'apache' in pillar and 'php-ini' in pillar['apache'] %}
  20. /etc/php5/apache2/php.ini:
  21. file.managed:
  22. - source: {{ pillar['apache']['php-ini'] }}
  23. - order: 225
  24. - watch_in:
  25. - module: apache-restart
  26. - require:
  27. - pkg: apache
  28. - pkg: mod-php5
  29. {% endif %}
  30. {% elif grains['os_family']=="FreeBSD" %}
  31. {{ apache.modulesdir }}/050_mod_php5.conf:
  32. file.managed:
  33. - source: salt://apache/files/{{ salt['grains.get']('os_family') }}/mod_php5.conf.jinja
  34. - mode: 644
  35. - template: jinja
  36. - require:
  37. - pkg: apache
  38. - watch_in:
  39. - module: apache-restart
  40. {% endif %}
  41. {% if grains['os_family']=="Suse" or salt['grains.get']('os') == 'SUSE' %}
  42. /etc/sysconfig/apache2:
  43. file.replace:
  44. - unless: grep '^APACHE_MODULES=.*php5' /etc/sysconfig/apache2
  45. - pattern: '^APACHE_MODULES=(.*)"'
  46. - repl: 'APACHE_MODULES=\1 php5"'
  47. {% endif %}