ansible-role-php/tasks/php.yml

40 lines
1.1 KiB
YAML

---
- name: "PHP | Enable PHP cli configuration"
ansible.builtin.template:
src: php-cli.ini.j2
dest: "/etc/php/{{ php_version.stdout }}/cli/conf.d/30-{{ inventory_hostname }}.ini"
mode: "0644"
- name: "PHP | Enable PHP FPM configuration"
ansible.builtin.template:
src: php-fpm.ini.j2
dest: "/etc/php/{{ php_version.stdout }}/fpm/conf.d/30-{{ inventory_hostname }}.ini"
mode: "0644"
when: "'php-fpm' in ansible_facts.packages"
notify: reload php-fpm
- name: "PHP | Create log directory"
ansible.builtin.file:
path: "{{ php_fpm_log_dir }}"
state: directory
mode: "0755"
when: php_fpm_create_log_dir
- name: "PHP | Copy template for PHP-FPM systemd service and socket"
ansible.builtin.template:
src: "systemd/{{ item }}.j2"
dest: "/etc/systemd/system/{{ item }}"
mode: "0644"
loop:
- php-fpm@.service
- php-fpm@.socket
notify:
- stop php-fpm-socket
- stop php-fpm-service
- start php-fpm-socket
- name: "PHP | Disable default service"
ansible.builtin.systemd:
name: "php{{ php_version.stdout }}-fpm.service"
state: stopped
enabled: false