Saltstack Official PHP Formula
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

pools_config.sls 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # Manages the php-fpm pools config files
  2. {% from 'php/map.jinja' import php with context %}
  3. {% from "php/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. {% set pillar_php_version = salt['pillar.get']('php:version', '7.0') %}
  18. {% if pillar_php_version is iterable and pillar_php_version is not string %}
  19. {% set first_fpath = path_join(config.get('filename', pool), php.lookup.fpm.pools) %}
  20. {% set first_version = pillar_php_version[0]|string %}
  21. {% set fpath = first_fpath.replace(first_version, config.get('phpversion', '7.0')) %}
  22. {% else %}
  23. {% set fpath = path_join(config.get('filename', pool), php.lookup.fpm.pools) %}
  24. {% endif %}
  25. {{ state }}:
  26. {% if config.enabled %}
  27. file.managed:
  28. {{ sls_block(config.get('opts', {})) }}
  29. - name: {{ fpath }}
  30. - source: salt://php/files/php.ini
  31. - template: jinja
  32. - context:
  33. config: {{ serialize(config.get('settings', {})) }}
  34. {% else %}
  35. file.absent:
  36. - name: {{ fpath }}
  37. {% endif %}
  38. {% do pool_states.append(state) %}
  39. {% endfor %}