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.

85 line
2.5KB

  1. # -*- coding: utf-8 -*-
  2. # vim: ft=sls
  3. {%- set tplroot = tpldir.split('/')[0] %}
  4. {%- set sls_service_running = tplroot ~ '.service.running' %}
  5. {%- set sls_package_install = tplroot ~ '.package.install' %}
  6. {%- from tplroot ~ "/map.jinja" import apache with context %}
  7. include:
  8. - {{ sls_service_running }}
  9. - {{ sls_package_install }}
  10. apache-config-modules-php5-pkg:
  11. pkg.installed:
  12. - name: {{ apache.mod_php5 }}
  13. - order: 180
  14. - require:
  15. - pkg: apache-package-install-pkg-installed
  16. {%- if grains['os_family'] in ('Suse', 'Debian',) %}
  17. cmd.run:
  18. - name: a2enmod php5
  19. - unless: ls {{ apache.moddir }}/php5.load || egrep "^APACHE_MODULES=" /etc/sysconfig/apache2 | grep ' php5'
  20. - order: 225
  21. - require:
  22. - pkg: apache-config-modules-php5-pkg
  23. - watch_in:
  24. - module: apache-service-running-restart
  25. - require_in:
  26. - module: apache-service-running-restart
  27. - module: apache-service-running-reload
  28. - service: apache-service-running
  29. {%- if 'apache' in pillar and 'php-ini' in pillar['apache'] %}
  30. file.managed:
  31. - name: /etc/php5/apache2/php.ini
  32. - source: {{ pillar['apache']['php-ini'] }}
  33. - order: 225
  34. - makedirs: True
  35. - template: {{ apache.get('template_engine', 'jinja') }}
  36. - context:
  37. svcname: {{ apache.service.name }}
  38. - watch_in:
  39. - module: apache-service-running-restart
  40. - require_in:
  41. - module: apache-service-running-restart
  42. - module: apache-service-running-reload
  43. - service: apache-service-running
  44. - require:
  45. - pkg: apache-package-install-pkg-installed
  46. - pkg: apache-config-modules-php5-pkg
  47. {%- endif %}
  48. {%- elif grains['os_family']=="FreeBSD" %}
  49. file.managed:
  50. - name: {{ apache.modulesdir }}/050_mod_php5.conf
  51. - source: salt://apache/files/{{ salt['grains.get']('os_family') }}/mod_php5.conf.jinja
  52. - mode: 644
  53. - makedirs: True
  54. - template: {{ apache.get('template_engine', 'jinja') }}
  55. - context:
  56. svcname: {{ apache.service.name }}
  57. - require:
  58. - pkg: apache-package-install-pkg-installed
  59. - watch_in:
  60. - module: apache-service-running-restart
  61. - require_in:
  62. - module: apache-service-running-restart
  63. - module: apache-service-running-reload
  64. - service: apache-service-running
  65. {%- elif grains['os_family']=="Suse" %}
  66. file.replace:
  67. - name: /etc/sysconfig/apache2
  68. - unless: grep '^APACHE_MODULES=.*php5' /etc/sysconfig/apache2
  69. - pattern: '^APACHE_MODULES=(.*)"'
  70. - repl: 'APACHE_MODULES=\1 php5"'
  71. {%- endif %}