2014-05-20 21:59:25 +02:00
|
|
|
# Manages the php-fpm pools config files
|
2014-05-22 20:38:27 +02:00
|
|
|
{% from 'php/ng/map.jinja' import php with context %}
|
|
|
|
{% from "php/ng/macro.jinja" import sls_block, serialize %}
|
2014-05-20 21:59:25 +02:00
|
|
|
|
|
|
|
# Simple path concatenation.
|
|
|
|
{% macro path_join(file, root) -%}
|
|
|
|
{{ root ~ '/' ~ file }}
|
|
|
|
{%- endmacro %}
|
|
|
|
|
|
|
|
{% set pool_states = [] %}
|
|
|
|
|
2015-07-13 16:02:46 +02:00
|
|
|
{% for pool, config in php.fpm.pools.iteritems() %}
|
2017-10-17 10:49:42 +02:00
|
|
|
{% if pool == 'defaults' %}{% continue %}{% endif %}
|
|
|
|
{% for pkey, pvalues in config.get('settings', {}).iteritems() %}
|
|
|
|
{% set pool_defaults = php.fpm.pools.get('defaults', {}).copy() %}
|
|
|
|
{% do pool_defaults.update(pvalues) %}
|
|
|
|
{% do pvalues.update(pool_defaults) %}
|
|
|
|
{% endfor %}
|
2014-05-20 21:59:25 +02:00
|
|
|
{% set state = 'php_fpm_pool_conf_' ~ loop.index0 %}
|
2016-07-12 19:19:36 +02:00
|
|
|
{% set fpath = path_join(config.get('filename', pool), php.lookup.fpm.pools) %}
|
2014-05-20 21:59:25 +02:00
|
|
|
|
|
|
|
{{ state }}:
|
|
|
|
{% if config.enabled %}
|
|
|
|
file.managed:
|
2014-06-06 21:06:49 +02:00
|
|
|
{{ sls_block(config.get('opts', {})) }}
|
2014-05-20 21:59:25 +02:00
|
|
|
- name: {{ fpath }}
|
|
|
|
- source: salt://php/ng/files/php.ini
|
|
|
|
- template: jinja
|
|
|
|
- context:
|
2014-06-06 21:06:49 +02:00
|
|
|
config: {{ serialize(config.get('settings', {})) }}
|
2014-05-20 21:59:25 +02:00
|
|
|
{% else %}
|
|
|
|
file.absent:
|
|
|
|
- name: {{ fpath }}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% do pool_states.append(state) %}
|
|
|
|
{% endfor %}
|