@@ -14,6 +14,39 @@ include:
1414 {% endif % }
1515{% endfor % }
1616
17+ {% set pillar_php_ng_version = salt[' pillar.get' ](' php:ng:version' , ' 7.0' ) % }
18+ {% if pillar_php_ng_version is iterable and pillar_php_ng_version is not string % }
19+ {% for version in pillar_php_ng_version % }
20+ {% set conf_settings = odict(php.lookup.fpm.defaults) % }
21+ {% set first_version = pillar_php_ng_version[0 ]| string % }
22+ {% set ini = php.lookup.fpm.ini| replace(first_version, version) % }
23+ {% set conf = php.lookup.fpm.conf| replace(first_version, version) % }
24+ {% set pools = php.lookup.fpm.pools| replace(first_version, version) % }
25+
26+ {% for key, value in conf_settings.items() % }
27+ {% if value is string % }
28+ {% do conf_settings.update({key: value.replace(first_version, version)}) % }
29+ {% endif % }
30+ {% endfor % }
31+ {% do conf_settings.global .update({' pid' : ' /var/run/php' + version + ' -fpm.pid' }) % }
32+ {% do conf_settings.global .update({' error_log' : ' /var/log/php' + version + ' -fpm.log' }) % }
33+
34+ php_fpm_ini_config_{{ version }}:
35+ {{ php_ini(ini, php.fpm.config.ini.opts, ini_settings) }}
36+
37+ php_fpm_conf_config_{{ version }}:
38+ {{ php_ini(conf, php.fpm.config.conf.opts, odict(conf_settings)) }}
39+
40+ {{ pools }}:
41+ file .directory:
42+ - name: {{ pools }}
43+ - user: {{ php.lookup.fpm.user }}
44+ - group: {{ php.lookup.fpm.group }}
45+ - file_mode: 755
46+ - make_dirs: True
47+ {% endfor % }
48+ {% else % }
49+
1750{% set conf_settings = php.lookup.fpm.defaults % }
1851{% do conf_settings.update(php.fpm.config.conf.settings) % }
1952
@@ -30,3 +63,4 @@ php_fpm_conf_config:
3063 - group: {{ php.lookup.fpm.group }}
3164 - file_mode: 755
3265 - make_dirs: True
66+ {% endif % }
0 commit comments