php-formula/php/ng/fpm/pools_config.sls
Rene Jochum ce9ce324ce Allow overwriting the fpm pools config name via 'filename'.
Signed-off-by: Rene Jochum <rene@jochums.at>
2016-07-12 19:20:16 +02:00

32 lines
848 B
Plaintext

# Manages the php-fpm pools config files
{% from 'php/ng/map.jinja' import php with context %}
{% from "php/ng/macro.jinja" import sls_block, serialize %}
# Simple path concatenation.
{% macro path_join(file, root) -%}
{{ root ~ '/' ~ file }}
{%- endmacro %}
{% set pool_states = [] %}
{% for pool, config in php.fpm.pools.iteritems() %}
{% set state = 'php_fpm_pool_conf_' ~ loop.index0 %}
{% set fpath = path_join(config.get('filename', pool), php.lookup.fpm.pools) %}
{{ state }}:
{% if config.enabled %}
file.managed:
{{ sls_block(config.get('opts', {})) }}
- name: {{ fpath }}
- source: salt://php/ng/files/php.ini
- template: jinja
- context:
config: {{ serialize(config.get('settings', {})) }}
{% else %}
file.absent:
- name: {{ fpath }}
{% endif %}
{% do pool_states.append(state) %}
{% endfor %}