ansible-roles/php/tasks/config_fpm.yml
Ludovic Poujol 585a8d04ac php: Change the default pool names to something more explicit (and same for the variables names)
Because it's more than just pure configuration, but a fpm pool 
definition, I've changed the following variables in Ansible :
- php_fpm_defaults_conf_file to replaced by php_fpm_default_pool_file
- php_fpm_custom_conf_file to php_fpm_default_pool_custom_file.

On the FPM side, I've also changed the files names of the pool to make 
them more explicit. No more z and zzz. It's the www pool, so let's put 
www in the file name for coherence : 
- z-evolinux-defaults.conf changes to www-evolinux-defaults.conf 
- zzz-evolinux-custom.conf changes to www-evolinux-zcustom.conf
2019-11-12 12:28:08 +01:00

83 lines
2.7 KiB
YAML

---
- name: Set default php.ini values for FPM
ini_file:
dest: "{{ php_fpm_defaults_ini_file }}"
section: PHP
option: "{{ item.option }}"
value: "{{ item.value }}"
mode: "0644"
create: yes
with_items:
- { option: "short_open_tag", value: "Off" }
- { option: "expose_php", value: "Off" }
- { option: "display_errors", value: "Off" }
- { option: "log_errors", value: "On" }
- { option: "html_errors", value: "Off" }
- { option: "allow_url_fopen", value: "Off" }
- { option: "opcache.memory_consumption", value: "128M" }
- { option: "opcache.max_accelerated_files", value: "8000" }
notify: "restart {{ php_fpm_service_name }}"
- name: Disable PHP functions for FPM
ini_file:
dest: "{{ php_fpm_defaults_ini_file }}"
section: PHP
option: disable_functions
value: "exec,shell-exec,system,passthru,putenv,popen"
notify: "restart {{ php_fpm_service_name }}"
- name: Custom php.ini for FPM
copy:
dest: "{{ php_fpm_custom_ini_file }}"
content: |
; Put customized values here.
force: no
notify: "restart {{ php_fpm_service_name }}"
- name: Set default PHP FPM values
ini_file:
dest: "{{ php_fpm_default_pool_file }}"
section: www
option: "{{ item.option }}"
value: "{{ item.value }}"
mode: "0644"
create: yes
with_items:
- { option: "user", value: "www-data" }
- { option: "group", value: "www-data" }
- { option: "listen", value: "{{ php_fpm_default_pool_socket }}" }
- { option: "listen.owner", value: "www-data" }
- { option: "listen.group", value: "www-data" }
- { option: "pm", value: "ondemand" }
- { option: "pm.max_children", value: "100" }
- { option: "pm.process_idle_timeout", value: "10s" }
- { option: "slowlog", value: "/var/log/$pool.log.slow" }
- { option: "request_slowlog_timeout", value: "5s" }
- { option: "pm.status_path", value: "/fpm_status" }
- { option: "request_terminate_timeout", value: "60s" }
notify: "restart {{ php_fpm_service_name }}"
when: ansible_distribution_major_version | version_compare('9', '>=')
- name: Custom PHP FPM values
copy:
dest: "{{ php_fpm_default_pool_custom_file }}"
content: |
; Put customized values here.
; default_charset = "ISO-8859-1"
mode: "0644"
force: no
notify: "restart {{ php_fpm_service_name }}"
- name: "Set custom values for PHP to enable Symfony"
ini_file:
dest: "{{ php_cli_custom_ini_file }}"
section: PHP
option: "{{ item.option }}"
value: "{{ item.value }}"
mode: "0644"
with_items:
- { option: "date.timezone", value: "Europe/Paris" }
notify: "restart {{ php_fpm_service_name }}"
when: php_symfony_requirements