Allow extra settings per pool, fix #350
This commit is contained in:
parent
79c917470c
commit
e8f42a7a3d
|
@ -83,6 +83,8 @@ The handler restarts PHP-FPM by default. Setting the value to `reloaded` will re
|
|||
pool_pm_min_spare_servers: 1
|
||||
pool_pm_max_spare_servers: 3
|
||||
pool_pm_max_requests: 500
|
||||
pool_extra_settings: |
|
||||
pm.status_path = /status
|
||||
|
||||
List of PHP-FPM pool to create. By default, www pool is created. To setup a new pool, add an item to php_fpm_pools list.
|
||||
|
||||
|
|
|
@ -44,6 +44,9 @@ php_fpm_pools:
|
|||
pool_pm_min_spare_servers: "{{ php_fpm_pm_min_spare_servers }}"
|
||||
pool_pm_max_spare_servers: "{{ php_fpm_pm_max_spare_servers }}"
|
||||
pool_pm_max_requests: "{{ php_fpm_pm_max_requests }}"
|
||||
# Note: you can add additional settings with pool_extra_settings, see below.
|
||||
# pool_extra_settings: |
|
||||
# pm.status_path = /status
|
||||
|
||||
# The executable to run when calling PHP from the command line.
|
||||
php_executable: "php"
|
||||
|
|
|
@ -9,6 +9,19 @@
|
|||
php_memory_limit: "192M"
|
||||
php_enablerepo: "remi,remi-php82"
|
||||
php_install_recommends: false
|
||||
php_fpm_pools:
|
||||
- pool_name: www
|
||||
pool_template: www.conf.j2
|
||||
pool_listen: "127.0.0.1"
|
||||
pool_listen_allowed_clients: "127.0.0.1"
|
||||
pool_pm: dynamic
|
||||
pool_pm_max_children: "10"
|
||||
pool_pm_start_servers: "10"
|
||||
pool_pm_min_spare_servers: "10"
|
||||
pool_pm_max_spare_servers: "10"
|
||||
pool_php_fpm_pm_max_requests: "10"
|
||||
pool_extra_settings: |
|
||||
pm.status_path = /status
|
||||
|
||||
handlers:
|
||||
- name: update apt cache
|
||||
|
@ -41,7 +54,7 @@
|
|||
|
||||
- name: Add Ondrej Sury's repo for PHP 8 (Ubuntu).
|
||||
apt_repository:
|
||||
repo: 'ppa:ondrej/php'
|
||||
repo: "ppa:ondrej/php"
|
||||
when: ansible_distribution == 'Ubuntu'
|
||||
|
||||
- name: Add Ondrej Sury's apt key (Debian).
|
||||
|
@ -67,6 +80,10 @@
|
|||
- role: geerlingguy.php
|
||||
|
||||
post_tasks:
|
||||
- name: Confirm PHP configuration is correct.
|
||||
- name: Confirm PHP configuration is correct. (memory_limit)
|
||||
shell: php -i | grep 'memory_limit.*192'
|
||||
changed_when: false
|
||||
|
||||
- name: Confirm PHP configuration is correct. (pm.status)
|
||||
shell: cat {{ php_fpm_pool_conf_path | dirname }}/www.conf | grep -q "pm.status_path = /status"
|
||||
changed_when: false
|
||||
|
|
|
@ -43,14 +43,14 @@
|
|||
force: true
|
||||
loop: "{{ php_fpm_pools | default([], true) }}"
|
||||
when: php_enable_php_fpm
|
||||
notify: restart php-fpm
|
||||
|
||||
- name: Ensure php-fpm is started and enabled at boot (if configured).
|
||||
service:
|
||||
name: "{{ php_fpm_daemon }}"
|
||||
state: "{{ php_fpm_state }}"
|
||||
enabled: "{{ php_fpm_enabled_on_boot }}"
|
||||
when:
|
||||
- php_enable_php_fpm
|
||||
- ansible_distribution != "Debian"
|
||||
- not ansible_check_mode
|
||||
# notify: restart php-fpm
|
||||
#
|
||||
# - name: Ensure php-fpm is started and enabled at boot (if configured).
|
||||
# service:
|
||||
# name: "{{ php_fpm_daemon }}"
|
||||
# state: "{{ php_fpm_state }}"
|
||||
# enabled: "{{ php_fpm_enabled_on_boot }}"
|
||||
# when:
|
||||
# - php_enable_php_fpm
|
||||
# - ansible_distribution != "Debian"
|
||||
# - not ansible_check_mode
|
||||
|
|
|
@ -15,3 +15,7 @@ pm.start_servers = {{ item.pool_pm_start_servers | default(5, true) }}
|
|||
pm.min_spare_servers = {{ item.pool_pm_min_spare_servers | default(5, true) }}
|
||||
pm.max_spare_servers = {{ item.pool_pm_max_spare_servers | default(5, true) }}
|
||||
pm.max_requests = {{ item.pool_pm_max_requests | default(500, true) }}
|
||||
|
||||
{% if item.pool_extra_settings is defined and item.pool_extra_settings %}
|
||||
{{ item.pool_extra_settings }}
|
||||
{% endif %}
|
||||
|
|
Loading…
Reference in New Issue