mirror of
https://github.com/HanXHX/ansible-php.git
synced 2026-04-15 13:32:09 +07:00
PHP7 Implementation
This commit is contained in:
@@ -1,16 +1,21 @@
|
||||
---
|
||||
|
||||
- name: APT | Install PHP-FPM
|
||||
apt: pkg=php5-fpm state=latest
|
||||
apt: pkg={{ php_fpm_service }} state=latest
|
||||
|
||||
- name: LINEINFILE | PHP configuration
|
||||
lineinfile: dest=/etc/php5/fpm/php.ini regexp='^;?{{ item.key }}' line='{{ item.key }} = {{ item.value }}'
|
||||
lineinfile: >
|
||||
dest='{{ php_etc_dir }}/fpm/php.ini'
|
||||
regexp='^;?{{ item.key }}'
|
||||
line='{{ item.key }} = {{ item.value }}'
|
||||
with_flattened:
|
||||
- php_ini
|
||||
- php_ini_fpm
|
||||
notify: restart php-fpm
|
||||
|
||||
- name: TEMPLATE | Deploy pool configuration
|
||||
template: src=etc/php5/fpm/pool.d/pool.conf.j2 dest=/etc/php5/fpm/pool.d/{{ item.pool_name }}.conf
|
||||
template: >
|
||||
src=etc/__php__/fpm/pool.d/pool.conf.j2
|
||||
dest='{{ php_etc_dir }}/fpm/pool.d/{{ item.pool_name }}.conf'
|
||||
with_items: php_fpm_poold
|
||||
notify: restart php-fpm
|
||||
|
||||
@@ -1,40 +1,43 @@
|
||||
---
|
||||
|
||||
- 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=/etc/php5/cli/php.ini regexp='^;?{{ item.key }}' line='{{ item.key }} = {{ item.value }}'
|
||||
lineinfile: >
|
||||
dest='{{ php_etc_dir }}/cli/php.ini'
|
||||
regexp='^;?{{ item.key }}'
|
||||
line='{{ item.key }} = {{ item.value }}'
|
||||
with_flattened:
|
||||
- php_ini
|
||||
- php_ini_cli
|
||||
|
||||
# Note: Xdebug is not packaged on PHP7.0
|
||||
- name: INCLUDE | Xdebug
|
||||
include: xdebug.yml
|
||||
when: php_install_xdebug
|
||||
when: php_install_xdebug and php_version == 5
|
||||
|
||||
- name: SHELL | Get PHP version on apt
|
||||
shell: php -v | head -n 1 | awk '{ print $2 }'
|
||||
register: php_apt_version
|
||||
changed_when: false
|
||||
|
||||
- name: APT | Install and configure php-apcu / opcache (PHP 5.5+ only)
|
||||
include: php55min.yml
|
||||
when: php_apt_version.stdout|version_compare('5.5', 'ge', False)
|
||||
|
||||
- name: APT | Install and configure php-apc (PHP 5.4 max only)
|
||||
include: php54max.yml
|
||||
when: php_apt_version.stdout|version_compare('5.5', 'lt', False)
|
||||
- name: APT | Install and configure opcache
|
||||
include: opcache.yml
|
||||
|
||||
|
||||
19
tasks/opcache.yml
Normal file
19
tasks/opcache.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
|
||||
- name: APT | Install php-apcu
|
||||
apt: pkg=php5-apcu state=latest
|
||||
when: php_version == 5
|
||||
|
||||
- name: TEMPLATE | Configure APCu
|
||||
template: >
|
||||
src=etc/__php__/mods-available/opcache.ini.j2
|
||||
dest="{{ php_mods_dir }}/opcache.ini"
|
||||
notify: restart php-fpm
|
||||
when: php_version == 5
|
||||
|
||||
- name: TEMPLATE | Configure APCu
|
||||
template: >
|
||||
src=etc/__php__/mods-available/apcu.ini.j2
|
||||
dest={{ php_mods_dir }}/apcu.ini
|
||||
notify: restart php-fpm
|
||||
when: php_version == 5
|
||||
@@ -1,11 +0,0 @@
|
||||
---
|
||||
|
||||
- name: APT | Install php-apcu
|
||||
apt: pkg=php-apc state=latest
|
||||
|
||||
- name: SET_FACT | Set APC
|
||||
set_fact: php_apc_package="apc"
|
||||
|
||||
- name: TEMPLATE | Configure APC
|
||||
template: src=etc/php5/mods-available/apcu.ini.j2 dest=/etc/php5/mods-available/apc.ini
|
||||
notify: restart php-fpm
|
||||
@@ -1,14 +0,0 @@
|
||||
---
|
||||
|
||||
- name: APT | Install php-apcu
|
||||
apt: pkg=php5-apcu state=latest
|
||||
|
||||
- name: SET_FACT | Set APCu
|
||||
set_fact: php_apc_package="apcu"
|
||||
|
||||
- name: TEMPLATE | Configure Opcache / APCu
|
||||
template: src=etc/php5/mods-available/{{ item }}.ini.j2 dest=/etc/php5/mods-available/{{ item }}.ini
|
||||
with_items:
|
||||
- apcu
|
||||
- opcache
|
||||
notify: restart php-fpm
|
||||
Reference in New Issue
Block a user