library/roles/php-fpm: Manage options set in php.ini. Lots of defaults in the pool template. No need to define tens of options anymore.

This commit is contained in:
Andrea Dell'Amico 2016-10-25 13:32:46 +02:00
parent 662c1ee357
commit 7a2e74177c
3 changed files with 17 additions and 8 deletions

View File

@ -16,6 +16,9 @@ phpfpm_base_dir: '/etc/php{{ php_version }}/fpm'
php_fpm_packages:
- 'php{{ php_version }}-fpm'
#php_global_settings:
# - { option='', value='', state='' }
# Main confign file settings
# It can be 'syslog'
phpfpm_logdir: /var/log/php-fpm
@ -33,8 +36,8 @@ phpfpm_event_mechanism: epoll
# Pools settings
phpfpm_default_pool_name: "www"
phpfpm_remove_default_pool: False
phpfpm_default_pool_name: "php-fpm"
phpfpm_remove_default_pool: True
phpfpm_use_default_template: True
phpfpm_create_users: True
phpfpm_default_user: php-fpm

View File

@ -21,6 +21,18 @@
notify: Reload php-fpm
tags: [ 'php', 'php_ini' ]
- name: Modify the global php settings
ini_file: dest={{ phpfpm_base_dir }}/php.ini section={{ item.section | default('PHP') }} option={{ item.option }} value={{ item.value }} backup=yes state={{ item.state | default('present') }}
with_items: '{{ php_global_settings | default([]) }}'
notify: Reload php-fpm
tags: [ 'php', 'php_ini' ]
- name: Modify the global php cli settings
ini_file: dest=/etc/php{{ php_version}}/cli/php.ini section={{ item.section | default('PHP') }} option={{ item.option }} value={{ item.value }} backup=yes state={{ item.state | default('present') }}
with_items: '{{ php_global_settings | default([]) }}'
notify: Reload php-fpm
tags: [ 'php', 'php_ini' ]
- name: Activate the memcache sessions support and redundancy if needed
action: configfile path={{ phpfpm_base_dir }}/conf.d/20-memcache.ini key={{ item.prop }} value='{{ item.value }}'
when: phpfpm_use_memcache_redundancy_sessions

View File

@ -118,9 +118,7 @@ pm.max_requests = {{ item.pm_max_requests | default('10000') }}
; anything, but it may not be a good idea to use the .php extension or it
; may conflict with a real PHP file.
; Default Value: not set
{% if item.pm_status_enabled %}
pm.status_path = {{ item.pm_status_path | default('/status') }}
{% endif %}
; The ping URI to call the monitoring page of FPM. If this value is not set, no
; URI will be recognized as a ping page. This could be used to test from outside
@ -132,16 +130,12 @@ pm.status_path = {{ item.pm_status_path | default('/status') }}
; anything, but it may not be a good idea to use the .php extension or it
; may conflict with a real PHP file.
; Default Value: not set
{% if item.ping_enabled %}
ping.path = {{ item.ping_path | default('/ping') }}
{% endif %}
; This directive may be used to customize the response of a ping request. The
; response is formatted as text/plain with a 200 response code.
; Default Value: pong
{% if item.ping_enabled %}
ping.response = {{ item.ping_response | default('www') }}
{% endif %}
access.log = /var/log/php-fpm/$pool-access.log