geerlingguy / ansible-role-php

Ansible Role - PHP
https://galaxy.ansible.com/geerlingguy/php/
MIT License
496 stars 441 forks source link

Either mention or remove the force: false flag for "Ensure the default pool exists." task #311

Closed mhitza closed 3 years ago

mhitza commented 4 years ago

CentOS will configure a default www pool when the PHP fpm package is installed and as part of that configuration, it will change the global session.save_path.

This can result in surprising behavior as it's expected by this role to self manage the www.conf pool file, however, for reasons that I cannot find in the commit history, updates to that file are prevented if the file already exists. https://github.com/geerlingguy/ansible-role-php/blob/master/tasks/configure-fpm.yml#L43

Could we maybe add a note in the docs, or even overwrite the file if it's different?

porcospino commented 4 years ago

It's worth mentioning that this problem is masked by the fact that the regular expressions below match lines in an existing file found at php_fpm_pool_conf_path

- name: Configure php-fpm pool (if enabled).
  lineinfile:
    dest: "{{ php_fpm_pool_conf_path }}"
    regexp: "{{ item.regexp }}"
    line: "{{ item.line }}"
    state: present
  with_items:
    - regexp: "^user.?=.+$"
      line: "user = {{ php_fpm_pool_user }}"
    - regexp: "^group.?=.+$"
      line: "group = {{ php_fpm_pool_group }}"
    - regexp: "^listen.?=.+$"
      line: "listen = {{ php_fpm_listen }}"
    - 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 }}"

This makes it easy to assume that the template is being used. But because it isn't, the following values remain the default

listen.owner = nobody
listen.group = nobody
pm.max_requests = 0
stale[bot] commented 3 years ago

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

stale[bot] commented 3 years ago

This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.