--- - name: Configure php-fpm ansible.builtin.template: src: "etc/php/conf.d/99-nextcloud.ini.j2" dest: "/etc/php/{{ php_version }}/{{ item }}/conf.d/99-nextcloud.ini" owner: root group: root mode: "0644" loop: - fpm - cli notify: - restart php-fpm - name: Find enabled php-fpm apache2 config ansible.builtin.find: paths: ["/etc/apache2/conf-enabled/"] patterns: ["php*-fpm.conf"] register: php_register_conf_enabled - name: Enable wanted and disable unwanted php-fpm apache2 config ansible.builtin.file: path: "{{ item.path }}" state: | {%- if item.path.endswith(wanted) -%} link {%- else -%} absent {%- endif -%} src: "/etc/apache2/conf-available{{ wanted }}" owner: root group: root mode: "0644" vars: wanted: "/php{{ php_version }}-fpm.conf" loop: "{{ php_register_conf_enabled.files }}" notify: - restart apache2 - name: Enable apache2 modules community.general.apache2_module: name: "{{ item }}" loop: - proxy_fcgi - setenvif notify: - restart apache2 - name: Start and enable php-fpm ansible.builtin.service: name: "php{{ php_version }}-fpm.service" state: started enabled: true