Restart the service when it fails (default).

This commit is contained in:
Andrea Dell'Amico 2020-09-01 13:40:01 +02:00
parent c9b9af7968
commit cddfb4ad27
4 changed files with 12 additions and 3 deletions

View File

@ -38,6 +38,7 @@ phpfpm_process_max: 256
phpfpm_set_event_mechanism: False
phpfpm_event_mechanism: epoll
php_service_restart_policy: 'on-failure'
# Pools settings
phpfpm_default_pool_name: "php-fpm"

View File

@ -6,9 +6,9 @@ galaxy_info:
license: license (EUPL)
min_ansible_version: 2.7
platforms:
- name: EL
- name: Ubuntu
versions:
- 7
- bionic
galaxy_tags:
- php
- php-fpm

View File

@ -26,7 +26,7 @@
notify: Reload php-fpm
- 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') }}
ini_file: dest={{ phpfpm_base_dir }}/php.ini section={{ item.section | default('PHP') }} option={{ item.option }} value={{ item.value }} state={{ item.state | default('present') }}
with_items: '{{ php_global_settings | default([]) }}'
notify: Reload php-fpm
@ -82,6 +82,12 @@
- name: Manage the php-fpm service
block:
- name: Create the systemd override directory
file: dest=/etc/systemd/system/php{{ php_version }}-fpm.service.d state=directory owner=root group=root mode='0755'
- name: Install the unit override file
template: php-fpm.service.override.conf.j2 dest=/etc/systemd/system/php{{ php_version }}-fpm.service.d/override.conf owner=root group=root mode='0644'
- name: Ensure that the php-fpm service is started and enabled
service: name=php{{ php_version }}-fpm state=started enabled=yes
when: phpfpm_service_enabled | bool

View File

@ -0,0 +1,2 @@
[Service]
Restart={{ php_service_restart_policy }}