Saltstack Official PHP Formula
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

config.sls 2.2KB

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