Saltstack Official PHP Formula
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

45 líneas
1.4KB

  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.items() %}
  10. {% if pool == 'defaults' %}{% continue %}{% endif %}
  11. {% for pkey, pvalues in config.get('settings', {}).items() %}
  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. {% if salt['pillar.get']('php:ng:version') is iterable %}
  18. {% set first_fpath = path_join(config.get('filename', pool), php.lookup.fpm.pools) %}
  19. {% set first_version = salt['pillar.get']('php:ng:version')[0]|string %}
  20. {% set fpath = first_fpath.replace(first_version, config.get('phpversion', '7.0')) %}
  21. {% else %}
  22. {% set fpath = path_join(config.get('filename', pool), php.lookup.fpm.pools) %}
  23. {% endif %}
  24. {{ state }}:
  25. {% if config.enabled %}
  26. file.managed:
  27. {{ sls_block(config.get('opts', {})) }}
  28. - name: {{ fpath }}
  29. - source: salt://php/ng/files/php.ini
  30. - template: jinja
  31. - context:
  32. config: {{ serialize(config.get('settings', {})) }}
  33. {% else %}
  34. file.absent:
  35. - name: {{ fpath }}
  36. {% endif %}
  37. {% do pool_states.append(state) %}
  38. {% endfor %}