2016-01-15 03:47:25 +01:00
|
|
|
---
|
|
|
|
- name: Define php_fpm_daemon.
|
|
|
|
set_fact:
|
|
|
|
php_fpm_daemon: "{{ __php_fpm_daemon }}"
|
|
|
|
when: php_fpm_daemon is not defined
|
|
|
|
|
2016-01-22 11:00:30 +01:00
|
|
|
- name: Define php_fpm_pool_conf_path.
|
|
|
|
set_fact:
|
|
|
|
php_fpm_pool_conf_path: "{{ __php_fpm_pool_conf_path }}"
|
|
|
|
when: php_fpm_pool_conf_path is not defined
|
|
|
|
|
2016-05-19 16:07:12 +02:00
|
|
|
- name: Define php_fpm_pool_user.
|
|
|
|
set_fact:
|
|
|
|
php_fpm_pool_user: "{{ __php_fpm_pool_user }}"
|
|
|
|
when: php_fpm_pool_user is not defined
|
|
|
|
|
|
|
|
- name: Define php_fpm_pool_group.
|
|
|
|
set_fact:
|
|
|
|
php_fpm_pool_group: "{{ __php_fpm_pool_group }}"
|
|
|
|
when: php_fpm_pool_group is not defined
|
|
|
|
|
2016-04-12 03:27:47 +02:00
|
|
|
- name: Stat php_fpm_pool_conf_path
|
|
|
|
stat:
|
|
|
|
path: "{{ php_fpm_pool_conf_path | dirname }}"
|
2016-04-12 01:47:48 +02:00
|
|
|
register: php_fpm_pool_conf_path_dir_stat
|
|
|
|
|
2016-03-07 04:26:53 +01:00
|
|
|
- name: Ensure the default pool directory exists.
|
|
|
|
file:
|
|
|
|
path: "{{ php_fpm_pool_conf_path | dirname }}"
|
|
|
|
state: directory
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0755
|
2016-04-12 03:27:47 +02:00
|
|
|
when: php_fpm_pool_conf_path_dir_stat.stat.islnk is not defined
|
2016-03-07 04:26:53 +01:00
|
|
|
|
2016-03-07 04:06:46 +01:00
|
|
|
- name: Ensure the default pool exists.
|
2016-05-19 16:07:12 +02:00
|
|
|
template:
|
|
|
|
src: www.conf.j2
|
2016-03-07 04:06:46 +01:00
|
|
|
dest: "{{ php_fpm_pool_conf_path }}"
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
2018-09-29 21:41:26 +02:00
|
|
|
force: false
|
2017-02-19 02:54:16 +01:00
|
|
|
when: php_enable_php_fpm
|
2016-03-07 04:06:46 +01:00
|
|
|
|
2016-01-15 03:47:25 +01:00
|
|
|
- name: Configure php-fpm pool (if enabled).
|
|
|
|
lineinfile:
|
|
|
|
dest: "{{ php_fpm_pool_conf_path }}"
|
|
|
|
regexp: "{{ item.regexp }}"
|
|
|
|
line: "{{ item.line }}"
|
|
|
|
state: present
|
|
|
|
with_items:
|
2016-06-11 05:22:47 +02:00
|
|
|
- regexp: "^user.?=.+$"
|
|
|
|
line: "user = {{ php_fpm_pool_user }}"
|
|
|
|
- regexp: "^group.?=.+$"
|
|
|
|
line: "group = {{ php_fpm_pool_group }}"
|
2016-01-15 03:47:25 +01:00
|
|
|
- regexp: "^listen.?=.+$"
|
2016-01-18 05:01:29 +01:00
|
|
|
line: "listen = {{ php_fpm_listen }}"
|
2016-01-15 03:47:25 +01:00
|
|
|
- regexp: '^listen\.allowed_clients.?=.+$'
|
|
|
|
line: "listen.allowed_clients = {{ php_fpm_listen_allowed_clients }}"
|
|
|
|
- regexp: '^pm\.max_children.?=.+$'
|
|
|
|
line: "pm.max_children = {{ php_fpm_pm_max_children }}"
|
|
|
|
- regexp: '^pm\.start_servers.?=.+$'
|
|
|
|
line: "pm.start_servers = {{ php_fpm_pm_start_servers }}"
|
|
|
|
- regexp: '^pm\.min_spare_servers.?=.+$'
|
|
|
|
line: "pm.min_spare_servers = {{ php_fpm_pm_min_spare_servers }}"
|
|
|
|
- regexp: '^pm\.max_spare_servers.?=.+$'
|
|
|
|
line: "pm.max_spare_servers = {{ php_fpm_pm_max_spare_servers }}"
|
|
|
|
when: php_enable_php_fpm
|
|
|
|
notify: restart php-fpm
|
|
|
|
|
|
|
|
- name: Ensure php-fpm is started and enabled at boot (if configured).
|
2017-05-17 05:05:27 +02:00
|
|
|
service:
|
|
|
|
name: "{{ php_fpm_daemon }}"
|
|
|
|
state: started
|
2018-09-29 21:41:26 +02:00
|
|
|
enabled: true
|
2017-05-17 05:05:27 +02:00
|
|
|
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).
|
2016-01-15 03:47:25 +01:00
|
|
|
service:
|
|
|
|
name: "{{ php_fpm_daemon }}"
|
|
|
|
state: started
|
2018-09-29 21:41:26 +02:00
|
|
|
enabled: true
|
2017-05-16 18:02:37 +02:00
|
|
|
use: service
|
2017-05-17 05:05:27 +02:00
|
|
|
when: php_enable_php_fpm and ansible_distribution == "Debian"
|