ansible-php/tasks/main.yml

43 lines
996 B
YAML

---
- name: ASSERT | Check variables
assert:
that: "php_version in php_managed_versions"
- name: INCLUDE_VARS | Related to PHP version
include_vars: "php-{{ php_version }}.yml"
- name: APT | Install PHP packages
apt: pkg={{ item }} state=latest update_cache=yes cache_valid_time=3600
with_flattened:
- php_packages
- php_extra_packages
# Note: only needed for PHP5x + Xdebug
- name: COMMAND | Get PHP extension dir
command: php-config --extension-dir
changed_when: false
register: php_extension_dir
when: php_version == '5.6'
- name: INCLUDE | PHP-FPM
include: fpm.yml
when: php_install_fpm
- name: LINEINFILE | PHP configuration
lineinfile: >
dest='{{ php_etc_dir }}/cli/php.ini'
regexp='^;?{{ item.key }}'
line='{{ item.key }} = {{ item.value }}'
with_flattened:
- php_ini
- php_ini_cli
- name: INCLUDE | Xdebug
include: xdebug.yml
when: php_install_xdebug
- name: APT | Install and configure opcache
include: opcache.yml