Add env vars on PHP-FPM pool template (#17)

Co-authored-by: Théo Adolphe <theo.adolphe@skilleos.com>
pull/19/head 2.6.2
Totooow 2022-10-06 16:36:02 +02:00 committed by GitHub
parent e9e74e2db6
commit 0a51826e2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 1 deletions

View File

@ -29,10 +29,11 @@
listen: "{{ p.listen | default(php_version | php_socket(p.name | default(p.pool_name))) }}", listen: "{{ p.listen | default(php_version | php_socket(p.name | default(p.pool_name))) }}",
user: "{{ p.user | default(php_default_user_group) }}", user: "{{ p.user | default(php_default_user_group) }}",
group: "{% if p.user is defined %}{{ p.group | default(p.user) }}{% else %}{{ p.group | default(php_default_user_group) }}{% endif %}", group: "{% if p.user is defined %}{{ p.group | default(p.user) }}{% else %}{{ p.group | default(php_default_user_group) }}{% endif %}",
php_env: {% if p.php_env is defined %}{{ p.php_env | to_nice_json }}{% else %}{}{% endif %},
php_value: {% if p.php_value is defined %}{{ p.php_value | to_nice_json }}{% else %}{}{% endif %}, php_value: {% if p.php_value is defined %}{{ p.php_value | to_nice_json }}{% else %}{}{% endif %},
php_admin_value: {% if p.php_admin_value is defined %}{{ p.php_admin_value | to_nice_json }}{% else %}{}{% endif %}, php_admin_value: {% if p.php_admin_value is defined %}{{ p.php_admin_value | to_nice_json }}{% else %}{}{% endif %},
{% for k, v in p.items() | list %} {% for k, v in p.items() | list %}
{% if k not in ['name', 'pool_name', 'listen', 'user', 'group', 'php_value', 'php_admin_value'] %} {% if k not in ['name', 'pool_name', 'listen', 'user', 'group', 'php_env', 'php_value', 'php_admin_value'] %}
{{ k }}: "{{ v }}"{% if not loop.last %},{% endif %} {{ k }}: "{{ v }}"{% if not loop.last %},{% endif %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}

View File

@ -421,6 +421,9 @@ catch_workers_output = {{ item.catch_workers_output | default('no') }}
;php_admin_value[error_log] = /var/log/fpm-php.www.log ;php_admin_value[error_log] = /var/log/fpm-php.www.log
;php_admin_flag[log_errors] = on ;php_admin_flag[log_errors] = on
;php_admin_value[memory_limit] = 32M ;php_admin_value[memory_limit] = 32M
{% for k, v in item.php_env.items() | list %}
env[{{ k }}] = {{ v }}
{% endfor %}
{% for k, v in item.php_value.items() | list %} {% for k, v in item.php_value.items() | list %}
php_value[{{ k }}] = {{ v }} php_value[{{ k }}] = {{ v }}
{% endfor %} {% endfor %}

View File

@ -25,6 +25,8 @@
ping_response: 'ok' ping_response: 'ok'
- name: 'test_ansible2' - name: 'test_ansible2'
user: 'foo' user: 'foo'
php_env:
foo: bar
php_value: php_value:
display_errors: 'Off' display_errors: 'Off'
php_admin_value: php_admin_value: