From 75bbecaf28967e3c4ad5be203bf923226121d832 Mon Sep 17 00:00:00 2001 From: Mario Fritschen Date: Tue, 17 Oct 2017 10:49:42 +0200 Subject: [PATCH] Add possibility to define default values for php-fpm pools --- php/ng/fpm/pools_config.sls | 6 ++++++ pillar.example | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/php/ng/fpm/pools_config.sls b/php/ng/fpm/pools_config.sls index e3d7aa7..9a66a55 100644 --- a/php/ng/fpm/pools_config.sls +++ b/php/ng/fpm/pools_config.sls @@ -10,6 +10,12 @@ {% set pool_states = [] %} {% for pool, config in php.fpm.pools.iteritems() %} +{% 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 %} {% set state = 'php_fpm_pool_conf_' ~ loop.index0 %} {% set fpath = path_join(config.get('filename', pool), php.lookup.fpm.pools) %} diff --git a/pillar.example b/pillar.example index c016190..59282d1 100644 --- a/pillar.example +++ b/pillar.example @@ -93,6 +93,12 @@ php: # settings for fpm-pools pools: + # defaults will apply for each pools settings and can be overwritten by pool settings + defaults: + user: nginx + group: nginx + listen: /var/run/php-fpm-default.sock + # name of the pool file to be managed, this will be appended # to the path specified in php.ng.lookup.fpm.pools 'mypool.conf':