Saltstack Official PHP Formula
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

90 行
2.3KB

  1. {%- from "php/map.jinja" import php with context %}
  2. include:
  3. - php
  4. - php.dev
  5. {%- set php_version = salt['pillar.get']('php:version', '7.0')|string %}
  6. {%- if salt['grains.get']('os') == "Ubuntu" %}
  7. {%- if php_version >= '7.0' %}
  8. {%- set suhosin_ext = php.suhosin7_ext %}
  9. {%- set suhosin_name = 'suhosin7' %}
  10. {%- set suhosin_repo = php.suhosin7_repo %}
  11. {%- set tmppath = '/tmp/suhosin7' %}
  12. {%- else %}
  13. {%- set suhosin_ext = php.suhosin5_ext %}
  14. {%- set suhosin_name = 'suhosin' %}
  15. {%- set suhosin_repo = php.suhosin5_repo %}
  16. {%- set tmppath = '/tmp/suhosin5' %}
  17. {%- endif %}
  18. {%- elif salt['grains.get']('os_family') == "RedHat" %}
  19. {%- if grains['osmajorrelease'] == "7" %}
  20. {%- set suhosin_ext = php.suhosin5_ext %}
  21. {%- set suhosin_name = 'suhosin' %}
  22. {%- set suhosin_repo = php.suhosin5_repo %}
  23. {%- set tmppath = '/tmp/suhosin5' %}
  24. {%- else %}
  25. {# RHEL version 6 contains PHP 5.3, which is not supported by Suhosin #}
  26. {%- endif %}
  27. {%- else %}
  28. {%- set suhosin_ext = php.suhosin5_ext %}
  29. {%- set suhosin_name = 'suhosin' %}
  30. {%- set suhosin_repo = php.suhosin5_repo %}
  31. {%- set tmppath = '/tmp/suhosin5' %}
  32. {%- endif %}
  33. build-pkgs:
  34. pkg.installed:
  35. - pkgs: {{ php.build_pkgs }}
  36. git:
  37. pkg.installed: []
  38. suhosin-source:
  39. git.latest:
  40. - name: {{ suhosin_repo }}
  41. - target: {{ tmppath }}
  42. - unless:
  43. - test -d {{ tmppath }}
  44. - require:
  45. - pkg: git
  46. install-suhosin:
  47. cmd.run:
  48. - name: |
  49. phpize
  50. ./configure
  51. make
  52. make install
  53. - cwd: {{ tmppath }}
  54. - shell: /bin/bash
  55. - runas: root
  56. - unless:
  57. - test -e {{ php.ext_conf_path }}/{{ suhosin_name }}.ini
  58. - require:
  59. - pkg: build-pkgs
  60. - git: suhosin-source
  61. php-suhosin-conf:
  62. file.managed:
  63. - name: {{ php.ext_conf_path }}/{{ suhosin_name }}.ini
  64. - contents: |
  65. extension={{ suhosin_ext }}
  66. suhosin.executor.include.whitelist=phar
  67. - require:
  68. - pkg: {{ php.php_pkg }}
  69. - cmd: install-suhosin
  70. - unless:
  71. - test -e {{ php.ext_conf_path }}/{{ suhosin_name }}.ini
  72. {%- if salt['grains.get']('os_family') == "Debian" %}
  73. php-suhosin-enable:
  74. cmd.run:
  75. - name: {{ php.phpenmod_command }} {{ suhosin_name }}
  76. - require:
  77. - file: php-suhosin-conf
  78. {%- endif %}