2015-07-22 14:40:20 +07:00
|
|
|
---
|
2015-07-23 15:40:33 +07:00
|
|
|
|
2018-03-18 23:28:57 +07:00
|
|
|
- name: INCLUDE_VARS | Related to OS family
|
|
|
|
include_vars: "OS_Family_{{ ansible_os_family }}.yml"
|
2016-01-22 21:57:29 +07:00
|
|
|
|
2018-03-18 23:28:57 +07:00
|
|
|
- name: INCLUDE_VARS | Related to OS version
|
2018-10-28 18:29:56 +07:00
|
|
|
include_vars: "{{ item }}"
|
|
|
|
with_first_found:
|
|
|
|
- "{{ ansible_distribution }}-{{ ansible_distribution_release }}.yml"
|
|
|
|
- "{{ ansible_distribution }}-{{ ansible_distribution_version }}.yml"
|
|
|
|
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
|
2016-12-08 23:38:10 +07:00
|
|
|
|
2015-07-23 15:40:33 +07:00
|
|
|
- name: APT | Install PHP packages
|
2018-03-18 23:28:57 +07:00
|
|
|
apt:
|
|
|
|
pkg: "{{ item }}"
|
|
|
|
state: present
|
|
|
|
update_cache: yes
|
|
|
|
cache_valid_time: 3600
|
2019-01-28 20:46:58 +07:00
|
|
|
loop: "{{ php_packages + php_extra_packages | flatten }}"
|
2017-03-16 22:10:18 +07:00
|
|
|
notify: restart php-fpm
|
2018-03-19 03:29:47 +07:00
|
|
|
when: ansible_os_family == 'Debian'
|
|
|
|
|
|
|
|
- name: PKGNG | Install PHP packages
|
|
|
|
pkgng:
|
|
|
|
name: "{{ item }}"
|
2019-01-28 20:46:58 +07:00
|
|
|
loop: "{{ php_packages + php_extra_packages | flatten }}"
|
2018-03-19 03:29:47 +07:00
|
|
|
notify: restart php-fpm
|
|
|
|
when: ansible_os_family == 'FreeBSD'
|
2015-07-23 15:40:33 +07:00
|
|
|
|
|
|
|
- name: INCLUDE | PHP-FPM
|
2015-07-23 22:10:15 +07:00
|
|
|
include: fpm.yml
|
2015-07-23 15:40:33 +07:00
|
|
|
|
2018-03-19 03:29:47 +07:00
|
|
|
- name: LINEINFILE | PHP CLI 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 }}'
|
2019-01-28 20:46:58 +07:00
|
|
|
loop: "{{ php_ini | combine(php_ini_cli) | dict2items }}"
|
2015-08-28 14:48:25 +07:00
|
|
|
|
2015-07-27 23:09:52 +07:00
|
|
|
- name: INCLUDE | Xdebug
|
|
|
|
include: xdebug.yml
|
2015-07-23 15:40:33 +07:00
|
|
|
|
2016-01-22 21:57:29 +07:00
|
|
|
- name: APT | Install and configure opcache
|
|
|
|
include: opcache.yml
|
2019-01-28 20:46:58 +07:00
|
|
|
|
|
|
|
- name: SERVICE | Ensure PHP-FPM is started
|
|
|
|
service:
|
|
|
|
name: '{{ php_fpm_service }}'
|
|
|
|
state: started
|
|
|
|
when: php_install_fpm and ansible_virtualization_type != 'docker'
|
|
|
|
|
|
|
|
- block:
|
|
|
|
|
|
|
|
- name: COMMAND | Check if PHP-FPM is started (Docker)
|
|
|
|
command: 'service {{ php_fpm_service }} status'
|
|
|
|
args:
|
|
|
|
warn: false
|
|
|
|
register: dps
|
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
|
|
|
|
|
|
|
- name: COMMAND | Ensure PHP-FPM is started (Docker)
|
|
|
|
command: 'service {{ php_fpm_service }} start'
|
|
|
|
args:
|
|
|
|
warn: false
|
|
|
|
when: dps.stdout.find('is not running') != -1
|
|
|
|
|
|
|
|
when: php_install_fpm and ansible_virtualization_type == 'docker'
|