--- - name: APT | Install PHP-FPM for Debian based systems apt: pkg: "{{ php_fpm_service }}" state: "{{ 'present' if php_install_fpm else 'absent' }}" when: ansible_os_family == 'Debian' - name: SERVICE | Enable service on FreeBSD service: name: "{{ php_fpm_service }}" enabled: "{{ 'yes' if php_install_fpm else 'no' }}" when: ansible_os_family == 'FreeBSD' - name: LINEINFILE | PHP configuration lineinfile: dest: '{{ php_fpm_ini }}' regexp: '^;?{{ item.key }}' line: '{{ item.key }} = {{ item.value }}' create: yes loop: "{{ php_ini | combine(php_ini_fpm) | dict2items }}" notify: restart php-fpm - name: TEMPLATE | Deploy pool configuration template: src: etc/__php__/fpm/pool.d/pool.conf.j2 dest: '{{ php_fpm_pool_dir }}/{{ item.name }}.conf' loop: "{{ ansible_local.hanxhx_php.fpm_pool }}" notify: restart php-fpm - name: FILE | Delete default pool if necessary file: path: "{{ php_fpm_pool_dir }}/www.conf" state: absent when: '"www" not in (ansible_local.hanxhx_php.fpm_pool | map(attribute="name") | list) and php_autoremove_default_pool' notify: restart php-fpm