Saltstack Official PHP Formula
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

64 lines
2.2KB

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