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.

38 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. # Simple path concatenation.
  5. {% macro path_join(file, root) -%}
  6. {{ root ~ '/' ~ file }}
  7. {%- endmacro %}
  8. {% set pool_states = [] %}
  9. {% for pool, config in php.fpm.pools.iteritems() %}
  10. {% if pool == 'defaults' %}{% continue %}{% endif %}
  11. {% for pkey, pvalues in config.get('settings', {}).iteritems() %}
  12. {% set pool_defaults = php.fpm.pools.get('defaults', {}).copy() %}
  13. {% do pool_defaults.update(pvalues) %}
  14. {% do pvalues.update(pool_defaults) %}
  15. {% endfor %}
  16. {% set state = 'php_fpm_pool_conf_' ~ loop.index0 %}
  17. {% set fpath = path_join(config.get('filename', pool), php.lookup.fpm.pools) %}
  18. {{ state }}:
  19. {% if config.enabled %}
  20. file.managed:
  21. {{ sls_block(config.get('opts', {})) }}
  22. - name: {{ fpath }}
  23. - source: salt://php/ng/files/php.ini
  24. - template: jinja
  25. - context:
  26. config: {{ serialize(config.get('settings', {})) }}
  27. {% else %}
  28. file.absent:
  29. - name: {{ fpath }}
  30. {% endif %}
  31. {% do pool_states.append(state) %}
  32. {% endfor %}