ansible-php/tasks/fpm.yml

37 lines
1.1 KiB
YAML

---
- 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_cli_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.pool_name }}.conf'
loop: "{{ php_fpm_poold }}"
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 (php_fpm_poold | map(attribute="pool_name") | list)'
notify: restart php-fpm