roles/php-fpm: Support php-fpm 7.2 on Ubuntu 18.04

Adds a separate handler for the php-fpm7.2 service and cleans up the
pool config file to remove some content that causes Jinja2 to choke.
This commit is contained in:
Alan Orth 2018-03-18 22:26:46 +02:00
parent 975a4d3f28
commit 9675542f7d
4 changed files with 43 additions and 4 deletions

View File

@ -3,4 +3,8 @@
- name: reload php7.0-fpm
systemd: name=php7.0-fpm state=reloaded
# For Ubuntu 18.04
- name: reload php7.2-fpm
systemd: name=php7.2-fpm state=reloaded
# vim: set ts=2 sw=2:

View File

@ -0,0 +1,34 @@
---
- name: Install php-fpm and deps
apt: name={{ item }} state=present update_cache=yes
with_items:
- php-fpm
# for WordPress
- php-mysql
- php-gd
- php-curl
# for Piwik
- php-mbstring
- php-xml
tags: php-fpm, packages
# only copy php-fpm config for vhosts that need WordPress or PHP
- name: Copy php-fpm pool config
template: src=php7.2-pool.conf.j2 dest=/etc/php/7.2/fpm/pool.d/{{ item.domain_name }}.conf owner=root group=root mode=0644
with_items: "{{ nginx_vhosts }}"
when: (item.has_wordpress is defined and item.has_wordpress == True) or (item.needs_php is defined and item.needs_php == True)
notify: reload php7.2-fpm
tags: php-fpm
- name: Remove default www pool
file: path=/etc/php/7.2/fpm/pool.d/www.conf state=absent
notify: reload php7.2-fpm
tags: php-fpm
# re-configure php.ini
- name: Update php.ini
template: src=php7.2-php.ini.j2 dest=/etc/php/7.2/fpm/php.ini owner=root group=root mode=0644
notify: reload php7.2-fpm
tags: php-fpm
# vim: set ts=2 sw=2:

View File

@ -7,4 +7,9 @@
when: ansible_distribution == 'Ubuntu' or (ansible_distribution == 'Debian' and ansible_distribution_major_version is version_compare('9', '=='))
tags: php-fpm
- name: Configure php-fpm on Ubuntu 18.04
import_tasks: Ubuntu_18.04.yml
when: ansible_distribution == 'Ubuntu' and ansible_distribution_version | version_compare('18.04', '==')
tags: php-fpm
# vim: set ts=2 sw=2:

View File

@ -301,13 +301,9 @@ pm.max_spare_servers = 3
; %t: server time the request was received
; it can accept a strftime(3) format:
; %d/%b/%Y:%H:%M:%S %z (default)
; The strftime(3) format must be encapsuled in a %{<strftime_format>}t tag
; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t
; %T: time the log has been written (the request has finished)
; it can accept a strftime(3) format:
; %d/%b/%Y:%H:%M:%S %z (default)
; The strftime(3) format must be encapsuled in a %{<strftime_format>}t tag
; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t
; %u: remote user
;
; Default: "%R - %u %t \"%m %r\" %s"