ansible-collection-nextcloud/roles/php/tasks/config.yml

56 lines
1.2 KiB
YAML
Raw Normal View History

2023-02-07 09:04:38 +01:00
---
- 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"]
file_type: file
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: yes