Saltstack Official PHP Formula
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

49 lines
1.5KB

  1. # Manages the php-fpm pools config files
  2. {% from 'php/ng/map.jinja' import php with context %}
  3. {% from "php/ng/macro.jinja" import sls_block, serialize %}
  4. include:
  5. - php.ng.deprecated
  6. # Simple path concatenation.
  7. {% macro path_join(file, root) -%}
  8. {{ root ~ '/' ~ file }}
  9. {%- endmacro %}
  10. {% set pool_states = [] %}
  11. {% for pool, config in php.fpm.pools.items() %}
  12. {% if pool == 'defaults' %}{% continue %}{% endif %}
  13. {% for pkey, pvalues in config.get('settings', {}).items() %}
  14. {% set pool_defaults = php.fpm.pools.get('defaults', {}).copy() %}
  15. {% do pool_defaults.update(pvalues) %}
  16. {% do pvalues.update(pool_defaults) %}
  17. {% endfor %}
  18. {% set state = 'php_fpm_pool_conf_' ~ loop.index0 %}
  19. {% set pillar_php_ng_version = salt['pillar.get']('php:ng:version', '7.0') %}
  20. {% if pillar_php_ng_version is iterable and pillar_php_ng_version is not string %}
  21. {% set first_fpath = path_join(config.get('filename', pool), php.lookup.fpm.pools) %}
  22. {% set first_version = pillar_php_ng_version[0]|string %}
  23. {% set fpath = first_fpath.replace(first_version, config.get('phpversion', '7.0')) %}
  24. {% else %}
  25. {% set fpath = path_join(config.get('filename', pool), php.lookup.fpm.pools) %}
  26. {% endif %}
  27. {{ state }}:
  28. {% if config.enabled %}
  29. file.managed:
  30. {{ sls_block(config.get('opts', {})) }}
  31. - name: {{ fpath }}
  32. - source: salt://php/ng/files/php.ini
  33. - template: jinja
  34. - context:
  35. config: {{ serialize(config.get('settings', {})) }}
  36. {% else %}
  37. file.absent:
  38. - name: {{ fpath }}
  39. {% endif %}
  40. {% do pool_states.append(state) %}
  41. {% endfor %}