Saltstack Official PHP Formula
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

67 lines
2.3KB

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