ansible-php/tasks/fpm.yml

37 lines
1.1 KiB
YAML
Raw Permalink 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
2018-03-18 23:28:57 +07:00
apt:
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
service:
name: "{{ php_fpm_service }}"
enabled: "{{ 'yes' if php_install_fpm else 'no' }}"
when: ansible_os_family == 'FreeBSD'
2015-07-23 15:40:33 +07:00
- name: LINEINFILE | PHP configuration
2017-11-10 18:19:39 +07:00
lineinfile:
2018-03-18 23:28:57 +07:00
dest: '{{ php_cli_ini }}'
2017-11-10 18:19:39 +07:00
regexp: '^;?{{ item.key }}'
line: '{{ item.key }} = {{ item.value }}'
2018-03-19 03:29:47 +07:00
create: yes
2019-01-28 20:46:58 +07:00
loop: "{{ php_ini | combine(php_ini_fpm) | dict2items }}"
2015-07-23 15:40:33 +07:00
notify: restart php-fpm
2015-07-23 22:10:15 +07:00
- name: TEMPLATE | Deploy pool configuration
2018-03-18 23:28:57 +07:00
template:
src: etc/__php__/fpm/pool.d/pool.conf.j2
dest: '{{ php_fpm_pool_dir }}/{{ item.name }}.conf'
loop: "{{ ansible_local.hanxhx_php.fpm_pool }}"
2015-07-23 22:10:15 +07:00
notify: restart php-fpm
- name: FILE | Delete default pool if necessary
file:
path: "{{ php_fpm_pool_dir }}/www.conf"
state: absent
2019-12-26 22:42:16 +07:00
when: '"www" not in (ansible_local.hanxhx_php.fpm_pool | map(attribute="name") | list) and php_autoremove_default_pool'
notify: restart php-fpm