diff --git a/tasks/configure-fpm.yml b/tasks/configure-fpm.yml index 6d3b761..e2e360f 100644 --- a/tasks/configure-fpm.yml +++ b/tasks/configure-fpm.yml @@ -9,6 +9,16 @@ php_fpm_pool_conf_path: "{{ __php_fpm_pool_conf_path }}" 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 stat: path: "{{ php_fpm_pool_conf_path | dirname }}" @@ -24,8 +34,8 @@ when: php_fpm_pool_conf_path_dir_stat.stat.islnk is not defined - name: Ensure the default pool exists. - copy: - src: www.conf + template: + src: www.conf.j2 dest: "{{ php_fpm_pool_conf_path }}" owner: root group: root diff --git a/files/www.conf b/templates/www.conf.j2 similarity index 75% rename from files/www.conf rename to templates/www.conf.j2 index 3f3ec7b..aaab17a 100644 --- a/files/www.conf +++ b/templates/www.conf.j2 @@ -1,8 +1,8 @@ [www] listen = 127.0.0.1:9000 listen.allowed_clients = 127.0.0.1 -user = www-data -group = www-data +user = {{ php_fpm_pool_user }} +group = {{ php_fpm_pool_group }} pm = dynamic pm.max_children = 50 diff --git a/vars/Debian.yml b/vars/Debian.yml index d68ad65..ae927c2 100644 --- a/vars/Debian.yml +++ b/vars/Debian.yml @@ -32,3 +32,6 @@ __php_opcache_conf_filename: 05-opcache.ini __php_fpm_daemon: php7.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_user: www-data +__php_fpm_pool_group: www-data diff --git a/vars/RedHat.yml b/vars/RedHat.yml index aa6f4d6..f17b982 100644 --- a/vars/RedHat.yml +++ b/vars/RedHat.yml @@ -28,3 +28,6 @@ __php_opcache_conf_filename: 10-opcache.ini __php_fpm_daemon: php-fpm __php_fpm_conf_path: "/etc/fpm" __php_fpm_pool_conf_path: "/etc/php-fpm.d/www.conf" + +__php_fpm_pool_user: apache +__php_fpm_pool_group: apache