Fix #120: Introduce variables for FPM user and group.

This commit is contained in:
Mathieu Garstecki 2016-05-19 16:07:12 +02:00
parent c2ef557806
commit 72c05c942f
4 changed files with 20 additions and 4 deletions

View File

@ -9,6 +9,16 @@
php_fpm_pool_conf_path: "{{ __php_fpm_pool_conf_path }}" php_fpm_pool_conf_path: "{{ __php_fpm_pool_conf_path }}"
when: php_fpm_pool_conf_path is not defined when: php_fpm_pool_conf_path is not defined
- 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
- name: Stat php_fpm_pool_conf_path - name: Stat php_fpm_pool_conf_path
stat: stat:
path: "{{ php_fpm_pool_conf_path | dirname }}" path: "{{ php_fpm_pool_conf_path | dirname }}"
@ -24,8 +34,8 @@
when: php_fpm_pool_conf_path_dir_stat.stat.islnk is not defined when: php_fpm_pool_conf_path_dir_stat.stat.islnk is not defined
- name: Ensure the default pool exists. - name: Ensure the default pool exists.
copy: template:
src: www.conf src: www.conf.j2
dest: "{{ php_fpm_pool_conf_path }}" dest: "{{ php_fpm_pool_conf_path }}"
owner: root owner: root
group: root group: root

View File

@ -1,8 +1,8 @@
[www] [www]
listen = 127.0.0.1:9000 listen = 127.0.0.1:9000
listen.allowed_clients = 127.0.0.1 listen.allowed_clients = 127.0.0.1
user = www-data user = {{ php_fpm_pool_user }}
group = www-data group = {{ php_fpm_pool_group }}
pm = dynamic pm = dynamic
pm.max_children = 50 pm.max_children = 50

View File

@ -32,3 +32,6 @@ __php_opcache_conf_filename: 05-opcache.ini
__php_fpm_daemon: php7.0-fpm __php_fpm_daemon: php7.0-fpm
__php_fpm_conf_path: "/etc/php/7.0/fpm" __php_fpm_conf_path: "/etc/php/7.0/fpm"
__php_fpm_pool_conf_path: "{{ __php_fpm_conf_path }}/pool.d/www.conf" __php_fpm_pool_conf_path: "{{ __php_fpm_conf_path }}/pool.d/www.conf"
__php_fpm_pool_user: www-data
__php_fpm_pool_group: www-data

View File

@ -28,3 +28,6 @@ __php_opcache_conf_filename: 10-opcache.ini
__php_fpm_daemon: php-fpm __php_fpm_daemon: php-fpm
__php_fpm_conf_path: "/etc/fpm" __php_fpm_conf_path: "/etc/fpm"
__php_fpm_pool_conf_path: "/etc/php-fpm.d/www.conf" __php_fpm_pool_conf_path: "/etc/php-fpm.d/www.conf"
__php_fpm_pool_user: apache
__php_fpm_pool_group: apache