ansible-php/tasks/fpm.yml

47 lines
1.4 KiB
YAML
Raw Normal View History

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
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
ansible.builtin.service:
2018-03-19 03:29:47 +07:00
name: "{{ php_fpm_service }}"
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
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 }}'
create: true
owner: root
group: root
mode: 0644
2019-01-28 20:46:58 +07:00
loop: "{{ php_ini | combine(php_ini_fpm) | dict2items }}"
when: php_install_fpm | bool
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
ansible.builtin.template:
2018-03-18 23:28:57 +07:00
src: etc/__php__/fpm/pool.d/pool.conf.j2
dest: '{{ php_fpm_pool_dir }}/{{ item.name }}.conf'
owner: root
group: root
mode: 0644
loop: "{{ ansible_local.hanxhx_php.fpm_pool }}"
when: php_install_fpm | bool
notify: Restart php-fpm
- name: FILE | Delete default pool if necessary
ansible.builtin.file:
path: "{{ php_fpm_pool_dir }}/www.conf"
state: absent
when:
- '"www" not in (ansible_local.hanxhx_php.fpm_pool | map(attribute="name") | list) and php_autoremove_default_pool'
- php_install_fpm | bool
notify: Restart php-fpm