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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. {#- Manages the php-fpm pools config files #}
  2. {%- set tplroot = tpldir.split('/')[0] %}
  3. {%- from tplroot ~ "/map.jinja" import php with context %}
  4. {%- from tplroot ~ "/macro.jinja" import sls_block, serialize %}
  5. {%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
  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_version = salt['pillar.get']('php:version', '7.0') %}
  20. {% if pillar_php_version is iterable and pillar_php_version is not string %}
  21. {% set first_fpath = path_join(config.get('filename', pool), php.lookup.fpm.pools) %}
  22. {% set first_version = pillar_php_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: {{ files_switch(['php.ini'],
  33. 'php_fpm_pool_conf'
  34. ) }}
  35. - template: jinja
  36. - context:
  37. config: {{ serialize(config.get('settings', {})) }}
  38. {% else %}
  39. file.absent:
  40. - name: {{ fpath }}
  41. {% endif %}
  42. {% do pool_states.append(state) %}
  43. {% endfor %}