diff --git a/roles/php-fpm/handlers/main.yml b/roles/php-fpm/handlers/main.yml index 2067b3a..10bde20 100644 --- a/roles/php-fpm/handlers/main.yml +++ b/roles/php-fpm/handlers/main.yml @@ -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: diff --git a/roles/php-fpm/tasks/Ubuntu_18.04.yml b/roles/php-fpm/tasks/Ubuntu_18.04.yml new file mode 100644 index 0000000..129f853 --- /dev/null +++ b/roles/php-fpm/tasks/Ubuntu_18.04.yml @@ -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: diff --git a/roles/php-fpm/tasks/main.yml b/roles/php-fpm/tasks/main.yml index 77c5994..175dd04 100644 --- a/roles/php-fpm/tasks/main.yml +++ b/roles/php-fpm/tasks/main.yml @@ -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: diff --git a/roles/php-fpm/templates/php7.2-pool.conf.j2 b/roles/php-fpm/templates/php7.2-pool.conf.j2 index f75f3cb..a75a683 100644 --- a/roles/php-fpm/templates/php7.2-pool.conf.j2 +++ b/roles/php-fpm/templates/php7.2-pool.conf.j2 @@ -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 %{}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 %{}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"