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.

32 lines
848B

  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. {% set state = 'php_fpm_pool_conf_' ~ loop.index0 %}
  11. {% set fpath = path_join(config.get('filename', pool), php.lookup.fpm.pools) %}
  12. {{ state }}:
  13. {% if config.enabled %}
  14. file.managed:
  15. {{ sls_block(config.get('opts', {})) }}
  16. - name: {{ fpath }}
  17. - source: salt://php/ng/files/php.ini
  18. - template: jinja
  19. - context:
  20. config: {{ serialize(config.get('settings', {})) }}
  21. {% else %}
  22. file.absent:
  23. - name: {{ fpath }}
  24. {% endif %}
  25. {% do pool_states.append(state) %}
  26. {% endfor %}