Mass cleanup and drop jessie support

This commit is contained in:
Emilien Mantel
2018-03-18 17:28:57 +01:00
parent 8e53b9cd80
commit 5878040e84
24 changed files with 130 additions and 185 deletions

View File

@@ -1,19 +1,20 @@
---
- name: APT | Install PHP-FPM
apt: pkg={{ php_fpm_service }} state=present
apt:
pkg: "{{ php_fpm_service }}"
- name: LINEINFILE | PHP configuration
lineinfile:
dest: '{{ php_etc_dir }}/fpm/php.ini'
dest: '{{ php_cli_ini }}'
regexp: '^;?{{ item.key }}'
line: '{{ item.key }} = {{ item.value }}'
with_dict: "{{ php_ini | combine(php_ini_fpm) }}"
notify: restart php-fpm
- name: TEMPLATE | Deploy pool configuration
template: >
src=etc/__php__/fpm/pool.d/pool.conf.j2
dest='{{ php_etc_dir }}/fpm/pool.d/{{ item.pool_name }}.conf'
template:
src: etc/__php__/fpm/pool.d/pool.conf.j2
dest: '{{ php_fpm_pool_dir }}/{{ item.pool_name }}.conf'
with_items: "{{ php_fpm_poold }}"
notify: restart php-fpm

View File

@@ -1,21 +1,17 @@
---
- name: INCLUDE_VARS | Related to OS
- name: INCLUDE_VARS | Related to OS family
include_vars: "OS_Family_{{ ansible_os_family }}.yml"
- name: INCLUDE_VARS | Related to OS version
include_vars: "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
- 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 | Update cache
apt: update_cache=yes cache_valid_time=3600
changed_when: false
- name: APT | Install PHP packages
apt: pkg={{ item }} state=present
apt:
pkg: "{{ item }}"
state: present
update_cache: yes
cache_valid_time: 3600
with_flattened:
- "{{ php_packages }}"
- "{{ php_extra_packages }}"
@@ -27,7 +23,7 @@
- name: LINEINFILE | PHP configuration
lineinfile:
dest: '{{ php_etc_dir }}/cli/php.ini'
dest: '{{ php_cli_ini }}'
regexp: '^;?{{ item.key }}'
line: '{{ item.key }} = {{ item.value }}'
with_dict: "{{ php_ini_cli }}"

View File

@@ -1,20 +1,21 @@
---
- name: APT | Install APCu
apt: pkg="{{ php_apt_prefix }}apcu" state=present
apt:
pkg: "{{ php_package_prefix }}apcu"
- name: APT | Install Opcache
apt: pkg="{{ php_apt_prefix }}opcache" state=present
when: php_version | version_compare('7.0', 'ge')
apt:
pkg: "{{ php_package_prefix }}opcache"
- name: TEMPLATE | Configure APCu
template: >
src=etc/__php__/mods-available/opcache.ini.j2
dest="{{ php_mods_dir }}/opcache.ini"
- name: TEMPLATE | Configure Opcache
template:
src: "etc/__php__/mods-available/opcache.ini.j2"
dest: "{{ php_mods_dir }}/opcache.ini"
notify: restart php-fpm
- name: TEMPLATE | Configure APCu
template: >
src=etc/__php__/mods-available/apcu.ini.j2
dest={{ php_mods_dir }}/apcu.ini
template:
src: "etc/__php__/mods-available/apcu.ini.j2"
dest: "{{ php_mods_dir }}/apcu.ini"
notify: restart php-fpm

View File

@@ -4,16 +4,11 @@
- name: APT | Install php-xdebug
apt:
pkg: "{{ php_apt_prefix }}xdebug"
pkg: "{{ php_package_prefix }}xdebug"
state: present
update_cache: yes
cache_valid_time: 3600
- name: SHELL | Get Xdebug version
shell: dpkg -l | awk '$2 ~ /xdebug$/ { print $3 }'
changed_when: false
register: xdebug_version
- name: TEMPLATE | Deploy module configurations
template:
src: "etc/__php__/mods-available/xdebug.ini.j2"
@@ -24,15 +19,8 @@
when: php_install_xdebug
- block:
# We can't uninstall as simple way. We can uninstall with php7.0-xdebug (virtual package), but removing virtual package doesn't affect real package.
# On Jessie: php5-xdebug, php-xdebug (sury for PHP 5.6/7.0/7.1/7.2), php5-xdebug + php7.0-xdebug (dotdeb)
# On Stretch: php-xdebug
- name: COMMAND | Disable xdebug package
command: phpdismod -v {{ php_version }} xdebug
args:
removes: "{{ php_etc_dir }}/cli/conf.d/20-xdebug.ini"
- name: APT | Uninstall php-xdebug
apt:
pkg: "{{ php_package_prefix }}xdebug"
state: absent
when: not php_install_xdebug