Saltstack Official PHP Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.1KB

  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 fpath = path_join(config.get('filename', pool), php.lookup.fpm.pools) %}
  20. {{ state }}:
  21. {% if config.enabled %}
  22. file.managed:
  23. {{ sls_block(config.get('opts', {})) }}
  24. - name: {{ fpath }}
  25. - source: salt://php/ng/files/php.ini
  26. - template: jinja
  27. - context:
  28. config: {{ serialize(config.get('settings', {})) }}
  29. {% else %}
  30. file.absent:
  31. - name: {{ fpath }}
  32. {% endif %}
  33. {% do pool_states.append(state) %}
  34. {% endfor %}