2015-07-23 15:40:33 +07:00
|
|
|
---
|
|
|
|
|
2018-03-19 03:29:47 +07:00
|
|
|
- name: APT | Install PHP-FPM for Debian based systems
|
2021-09-01 14:57:23 +07:00
|
|
|
ansible.builtin.apt:
|
2018-03-18 23:28:57 +07:00
|
|
|
pkg: "{{ php_fpm_service }}"
|
2018-03-19 03:29:47 +07:00
|
|
|
state: "{{ 'present' if php_install_fpm else 'absent' }}"
|
|
|
|
when: ansible_os_family == 'Debian'
|
|
|
|
|
|
|
|
- name: SERVICE | Enable service on FreeBSD
|
2021-09-01 14:57:23 +07:00
|
|
|
ansible.builtin.service:
|
2018-03-19 03:29:47 +07:00
|
|
|
name: "{{ php_fpm_service }}"
|
2021-09-01 14:57:23 +07:00
|
|
|
enabled: "{{ 'true' if php_install_fpm else 'false' }}"
|
2018-03-19 03:29:47 +07:00
|
|
|
when: ansible_os_family == 'FreeBSD'
|
2015-07-23 15:40:33 +07:00
|
|
|
|
|
|
|
- name: LINEINFILE | PHP configuration
|
2021-09-01 14:57:23 +07:00
|
|
|
ansible.builtin.lineinfile:
|
2020-05-27 17:59:25 +07:00
|
|
|
dest: '{{ php_fpm_ini }}'
|
2017-11-10 18:19:39 +07:00
|
|
|
regexp: '^;?{{ item.key }}'
|
|
|
|
line: '{{ item.key }} = {{ item.value }}'
|
2021-09-01 14:57:23 +07:00
|
|
|
create: true
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
2019-01-28 20:46:58 +07:00
|
|
|
loop: "{{ php_ini | combine(php_ini_fpm) | dict2items }}"
|
2022-11-07 17:03:58 +07:00
|
|
|
when: php_install_fpm | bool
|
2022-10-06 19:47:06 +07:00
|
|
|
notify: Restart php-fpm
|
2015-07-23 15:40:33 +07:00
|
|
|
|
2015-07-23 22:10:15 +07:00
|
|
|
- name: TEMPLATE | Deploy pool configuration
|
2021-09-01 14:57:23 +07:00
|
|
|
ansible.builtin.template:
|
2018-03-18 23:28:57 +07:00
|
|
|
src: etc/__php__/fpm/pool.d/pool.conf.j2
|
2019-12-26 20:13:00 +07:00
|
|
|
dest: '{{ php_fpm_pool_dir }}/{{ item.name }}.conf'
|
2021-09-01 14:57:23 +07:00
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
2019-12-26 20:13:00 +07:00
|
|
|
loop: "{{ ansible_local.hanxhx_php.fpm_pool }}"
|
2022-11-07 17:03:58 +07:00
|
|
|
when: php_install_fpm | bool
|
2022-10-06 19:47:06 +07:00
|
|
|
notify: Restart php-fpm
|
2019-04-19 19:36:35 +07:00
|
|
|
|
|
|
|
- name: FILE | Delete default pool if necessary
|
2021-09-01 14:57:23 +07:00
|
|
|
ansible.builtin.file:
|
2019-04-19 19:36:35 +07:00
|
|
|
path: "{{ php_fpm_pool_dir }}/www.conf"
|
|
|
|
state: absent
|
2022-11-07 17:03:58 +07:00
|
|
|
when:
|
|
|
|
- '"www" not in (ansible_local.hanxhx_php.fpm_pool | map(attribute="name") | list) and php_autoremove_default_pool'
|
|
|
|
- php_install_fpm | bool
|
2022-10-06 19:47:06 +07:00
|
|
|
notify: Restart php-fpm
|