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 = [] %}
|
|
|
|
|
|
|
|
{% for pool, config in php.fpm.pools.managed.items() %}
|
|
|
|
{% set state = 'php_fpm_pool_conf_' ~ loop.index0 %}
|
|
|
|
{% set fpath = path_join(pool, php.lookup.fpm.pools) %}
|
|
|
|
|
|
|
|
{{ state }}:
|
|
|
|
{% if config.enabled %}
|
|
|
|
file.managed:
|
|
|
|
{{ sls_block(php.fpm.pools.managed_opts) }}
|
|
|
|
- name: {{ fpath }}
|
|
|
|
- source: salt://php/ng/files/php.ini
|
|
|
|
- template: jinja
|
|
|
|
- context:
|
2014-05-22 20:38:27 +02:00
|
|
|
config: {{ serialize(config.settings) }}
|
2014-05-20 21:59:25 +02:00
|
|
|
{% else %}
|
|
|
|
file.absent:
|
|
|
|
- name: {{ fpath }}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% do pool_states.append(state) %}
|
|
|
|
{% endfor %}
|
|
|
|
|
|
|
|
|
|
|
|
|