Fixes #293: Allow PHP-FPM state and boot behavior to be configured.

This commit is contained in:
Jeff Geerling 2020-03-06 09:38:47 -06:00
parent fbae48db55
commit 07cb84c591
5 changed files with 13 additions and 13 deletions

View File

@ -62,6 +62,11 @@ When using this role with PHP running as `php-fpm` instead of as a process insid
If you're using Apache, you can easily get it configured to work with PHP-FPM using the [geerlingguy.apache-php-fpm](https://github.com/geerlingguy/ansible-role-apache-php-fpm) role.
php_fpm_state: started
php_fpm_enabled_on_boot: true
Control over the fpm daemon's state; set these to `stopped` and `false` if you want FPM to be installed and configured, but not running (e.g. when installing in a container).
php_fpm_listen: "127.0.0.1:9000"
php_fpm_listen_allowed_clients: "127.0.0.1"
php_fpm_pm_max_children: 50

View File

@ -18,6 +18,8 @@ php_enable_webserver: true
# PHP-FPM configuration.
php_enable_php_fpm: false
php_fpm_state: started
php_fpm_enabled_on_boot: true
php_fpm_listen: "127.0.0.1:9000"
php_fpm_listen_allowed_clients: "127.0.0.1"
php_fpm_pm_max_children: 50

View File

@ -10,4 +10,6 @@
service:
name: "{{ php_fpm_daemon }}"
state: restarted
when: php_enable_php_fpm
when:
- php_enable_php_fpm
- php_fpm_state == 'started'

View File

@ -6,7 +6,7 @@ galaxy_info:
description: PHP for RedHat/CentOS/Fedora/Debian/Ubuntu.
company: "Midwestern Mac, LLC"
license: "license (BSD, MIT)"
min_ansible_version: 2.4
min_ansible_version: 2.8
platforms:
- name: EL
versions:

View File

@ -72,15 +72,6 @@
- name: Ensure php-fpm is started and enabled at boot (if configured).
service:
name: "{{ php_fpm_daemon }}"
state: started
enabled: true
state: "{{ php_fpm_state }}"
enabled: "{{ php_fpm_enabled_on_boot }}"
when: php_enable_php_fpm and ansible_distribution != "Debian"
# See: https://github.com/ansible/ansible/issues/22303
- name: Ensure php-fpm is started and enabled at boot (if configured, Debian).
service:
name: "{{ php_fpm_daemon }}"
state: started
enabled: true
use: service
when: php_enable_php_fpm and ansible_distribution == "Debian"