{% endif %} | {% endif %} | ||||
{% endfor %} | {% endfor %} | ||||
{% if salt['pillar.get']('php:ng:version') is iterable %} | |||||
{% for version in salt['pillar.get']('php:ng:version') %} | |||||
{% set conf_settings = odict(php.lookup.fpm.defaults) %} | |||||
{% set first_version = salt['pillar.get']('php:ng:version')[0]|string %} | |||||
{% set ini = php.lookup.fpm.ini|replace(first_version, version) %} | |||||
{% set conf = php.lookup.fpm.conf|replace(first_version, version) %} | |||||
{% set pools = php.lookup.fpm.pools|replace(first_version, version) %} | |||||
{% for key, value in conf_settings.items() %} | |||||
{% if value is string %} | |||||
{% do conf_settings.update({key: value.replace(first_version, version)}) %} | |||||
{% endif %} | |||||
{% endfor %} | |||||
{% do conf_settings.global.update({'pid': '/var/run/php' + version + '-fpm.pid' }) %} | |||||
{% do conf_settings.global.update({'error_log': '/var/log/php' + version + '-fpm.log' }) %} | |||||
php_fpm_ini_config_{{ version }}: | |||||
{{ php_ini(ini, php.fpm.config.ini.opts, ini_settings) }} | |||||
php_fpm_conf_config_{{ version }}: | |||||
{{ php_ini(conf, php.fpm.config.conf.opts, odict(conf_settings)) }} | |||||
{{ pools }}: | |||||
file.directory: | |||||
- name: {{ pools }} | |||||
- user: {{ php.lookup.fpm.user }} | |||||
- group: {{ php.lookup.fpm.group }} | |||||
- file_mode: 755 | |||||
- make_dirs: True | |||||
{% endfor %} | |||||
{% else %} | |||||
{% set conf_settings = php.lookup.fpm.defaults %} | {% set conf_settings = php.lookup.fpm.defaults %} | ||||
{% do conf_settings.update(php.fpm.config.conf.settings) %} | {% do conf_settings.update(php.fpm.config.conf.settings) %} | ||||
- group: {{ php.lookup.fpm.group }} | - group: {{ php.lookup.fpm.group }} | ||||
- file_mode: 755 | - file_mode: 755 | ||||
- make_dirs: True | - make_dirs: True | ||||
{% endif %} |
php_fpm_service: | php_fpm_service: | ||||
service: | service: | ||||
- watch: | - watch: | ||||
{% if salt['pillar.get']('php:ng:version') is iterable %} | |||||
{% for version in salt['pillar.get']('php:ng:version') %} | |||||
- file: php_fpm_ini_config_{{ version }} | |||||
- file: php_fpm_conf_config_{{ version }} | |||||
{% endfor %} | |||||
{% else %} | |||||
- file: php_fpm_ini_config | - file: php_fpm_ini_config | ||||
- file: php_fpm_conf_config | - file: php_fpm_conf_config | ||||
{% endif %} | |||||
- require: | - require: | ||||
- sls: php.ng.fpm.config | - sls: php.ng.fpm.config | ||||
{% if salt['pillar.get']('php:ng:version') is iterable %} | |||||
{% for version in salt['pillar.get']('php:ng:version') %} | |||||
php_fpm_ini_config_{{ version }}: | |||||
file: | |||||
- require: | |||||
- pkg: php_install_fpm | |||||
php_fpm_conf_config_{{ version }}: | |||||
file: | |||||
- require: | |||||
- pkg: php_install_fpm | |||||
{% endfor %} | |||||
{% else %} | |||||
php_fpm_ini_config: | php_fpm_ini_config: | ||||
file: | file: | ||||
- require: | - require: | ||||
file: | file: | ||||
- require: | - require: | ||||
- pkg: php_install_fpm | - pkg: php_install_fpm | ||||
{% endif %} |
{% do pvalues.update(pool_defaults) %} | {% do pvalues.update(pool_defaults) %} | ||||
{% endfor %} | {% endfor %} | ||||
{% set state = 'php_fpm_pool_conf_' ~ loop.index0 %} | {% set state = 'php_fpm_pool_conf_' ~ loop.index0 %} | ||||
{% set fpath = path_join(config.get('filename', pool), php.lookup.fpm.pools) %} | |||||
{% if salt['pillar.get']('php:ng:version') is iterable %} | |||||
{% set first_fpath = path_join(config.get('filename', pool), php.lookup.fpm.pools) %} | |||||
{% set first_version = salt['pillar.get']('php:ng:version')[0]|string %} | |||||
{% set fpath = first_fpath.replace(first_version, config.get('phpversion', '7.0')) %} | |||||
{% else %} | |||||
{% set fpath = path_join(config.get('filename', pool), php.lookup.fpm.pools) %} | |||||
{% endif %} | |||||
{{ state }}: | {{ state }}: | ||||
{% if config.enabled %} | {% if config.enabled %} |
- source: salt://php/ng/files/php.ini | - source: salt://php/ng/files/php.ini | ||||
- template: jinja | - template: jinja | ||||
- context: | - context: | ||||
config: {{ serialize(settings) }} | |||||
config: {{ serialize(odict(settings)) }} | |||||
{%- endmacro -%} | {%- endmacro -%} |
{% do specials.append(pkg) %} | {% do specials.append(pkg) %} | ||||
{% else %} | {% else %} | ||||
{% do pkgs.append(pkg) %} | {% do pkgs.append(pkg) %} | ||||
{% if salt['pillar.get']('php:ng:version') is iterable %} | |||||
{% set first_version = salt['pillar.get']('php:ng:version')[0]|string %} | |||||
{% for other_version in salt['pillar.get']('php:ng:version') %} | |||||
{% set other_version_str = other_version|string %} | |||||
{% do pkgs.append(pkg.replace(first_version, other_version_str)) %} | |||||
{% endfor %} | |||||
{% endif %} | |||||
{% endif %} | {% endif %} | ||||
{% endfor %} | {% endfor %} | ||||
{% else %} | {% else %} | ||||
{% do pkgs.append(pkginfo) %} | {% do pkgs.append(pkginfo) %} | ||||
{% if salt['pillar.get']('php:ng:version') is iterable %} | |||||
{% set first_version = salt['pillar.get']('php:ng:version')[0]|string %} | |||||
{% for other_version in salt['pillar.get']('php:ng:version') %} | |||||
{% set other_version_str = other_version|string %} | |||||
{% do pkgs.append(pkginfo.replace(first_version, other_version_str)) %} | |||||
{% endfor %} | |||||
{% endif %} | |||||
{% endif %} | {% endif %} | ||||
{% if grains['os_family'] == "Debian" and (state == 'cli' or state == 'fpm' or state == 'php') %} | {% if grains['os_family'] == "Debian" and (state == 'cli' or state == 'fpm' or state == 'php') %} | ||||
- __env__: | - __env__: | ||||
- LC_ALL: C.UTF-8 | - LC_ALL: C.UTF-8 | ||||
- onlyif: | - onlyif: | ||||
- test ! -e /etc/apt/sources.list.d/ondrej-php.list | |||||
- test ! -e /etc/apt/sources.list.d/ondrej-php.list | |||||
- require_in: | - require_in: | ||||
- pkg: php_install_{{ state }} | - pkg: php_install_{{ state }} | ||||
pkg.latest: | pkg.latest: |
# -*- coding: utf-8 -*- | # -*- coding: utf-8 -*- | ||||
# vim: ft=jinja | # vim: ft=jinja | ||||
{%- set phpng_version = salt['pillar.get']('php:ng:version', '7.0')|string %} | |||||
{%- if salt['pillar.get']('php:ng:version') is iterable %} | |||||
{%- set phpng_version = salt['pillar.get']('php:ng:version')[0]|string %} | |||||
{% else %} | |||||
{%- set phpng_version = salt['pillar.get']('php:ng:version', '7.0')|string %} | |||||
{% endif %} | |||||
{%- set freebsd_phpng_version = phpng_version.replace('.', '') %} | {%- set freebsd_phpng_version = phpng_version.replace('.', '') %} | ||||
{%- if salt['grains.get']('os') == "Ubuntu" %} | {%- if salt['grains.get']('os') == "Ubuntu" %} |