Saltstack Official PHP Formula
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. {#- Manages the php-fpm main ini file #}
  2. {%- set tplroot = tpldir.split('/')[0] %}
  3. {%- from tplroot ~ "/map.jinja" import php with context %}
  4. {%- from tplroot ~ "/ini.jinja" import php_ini %}
  5. {%- set ini_settings = php.ini.defaults %}
  6. {%- for key, value in php.fpm.config.ini.settings.items() %}
  7. {%- if ini_settings[key] is defined %}
  8. {%- do ini_settings[key].update(value) %}
  9. {%- else %}
  10. {%- do ini_settings.update({key: value}) %}
  11. {%- endif %}
  12. {%- endfor %}
  13. {%- set pillar_php_version = salt['pillar.get']('php:version', '7.0') %}
  14. {%- if pillar_php_version is iterable and pillar_php_version is not string %}
  15. {%- for version in pillar_php_version %}
  16. {%- set conf_settings = odict(php.lookup.fpm.defaults) %}
  17. {%- set first_version = pillar_php_version[0]|string %}
  18. {%- set ini = php.lookup.fpm.ini|replace(first_version, version) %}
  19. {%- set conf = php.lookup.fpm.conf|replace(first_version, version) %}
  20. {%- set pools = php.lookup.fpm.pools|replace(first_version, version) %}
  21. {%- for key, value in conf_settings.items() %}
  22. {%- if value is string %}
  23. {%- do conf_settings.update({key: value.replace(first_version, version)}) %}
  24. {%- endif %}
  25. {%- endfor %}
  26. {%- do conf_settings.global.update({'pid': '/var/run/php' + version + '-fpm.pid' }) %}
  27. {%- do conf_settings.global.update({'error_log': '/var/log/php' + version + '-fpm.log' }) %}
  28. php_fpm_ini_config_{{ version }}:
  29. {{ php_ini(ini,
  30. 'php_fpm_ini_config_' ~ version,
  31. php.fpm.config.ini.opts,
  32. ini_settings
  33. ) }}
  34. php_fpm_conf_config_{{ version }}:
  35. {{ php_ini(conf,
  36. 'php_fpm_conf_config_' ~ version,
  37. php.fpm.config.conf.opts,
  38. odict(conf_settings)
  39. ) }}
  40. {{ pools }}:
  41. file.directory:
  42. - name: {{ pools }}
  43. - user: {{ php.lookup.fpm.user }}
  44. - group: {{ php.lookup.fpm.group }}
  45. - file_mode: 755
  46. - make_dirs: True
  47. {%- endfor %}
  48. {%- else %}
  49. {%- set conf_settings = php.lookup.fpm.defaults %}
  50. {%- do conf_settings.update(php.fpm.config.conf.settings) %}
  51. php_fpm_ini_config:
  52. {{ php_ini(php.lookup.fpm.ini,
  53. 'php_fpm_ini_config',
  54. php.fpm.config.ini.opts,
  55. ini_settings
  56. ) }}
  57. php_fpm_conf_config:
  58. {{ php_ini(php.lookup.fpm.conf,
  59. 'php_fpm_conf_config',
  60. php.fpm.config.conf.opts,
  61. conf_settings
  62. ) }}
  63. {{ php.lookup.fpm.pools }}:
  64. file.directory:
  65. - name: {{ php.lookup.fpm.pools }}
  66. - user: {{ php.lookup.fpm.user }}
  67. - group: {{ php.lookup.fpm.group }}
  68. - file_mode: 755
  69. - make_dirs: True
  70. {%- endif %}