@@ -1 +1,3 @@ | |||||
--- | --- | ||||
php_sury_repo: false | |||||
php_configure_opcache: false |
@@ -1 +1,6 @@ | |||||
--- | --- | ||||
- name: restart apache | |||||
service: | |||||
name: apache2 | |||||
state: restarted |
@@ -0,0 +1,20 @@ | |||||
--- | |||||
- name: find apache php modules which are not of the selected version | |||||
find: | |||||
path: /etc/apache2/mods-enabled/ | |||||
file_type: link | |||||
patterns: php* | |||||
excludes: "php{{php_version}}*" | |||||
register: _find_php_apache_mods | |||||
- name: disable apache php modules which are not of the selected version | |||||
file: | |||||
path: "{{item}}" | |||||
state: absent | |||||
with_items: "{{ _find_php_apache_mods | json_query('files[].path') }}" | |||||
- name: enable php apache module | |||||
apache2_module: | |||||
name: "php{{php_version}}" | |||||
state: present |
@@ -1 +1,6 @@ | |||||
--- | --- | ||||
- import_tasks: setup.yaml | |||||
- import_tasks: apache.yaml | |||||
- import_tasks: opcache.yaml | |||||
when: php_configure_opcache |
@@ -0,0 +1,8 @@ | |||||
--- | |||||
- name: enable php opcache | |||||
template: | |||||
src: php-opcache.conf.j2 | |||||
dest: /etc/php/{{php_version}}/apache2/conf.d/opcache.ini | |||||
notify: restart apache |
@@ -0,0 +1,50 @@ | |||||
--- | |||||
- when: php_sury_repo | |||||
block: | |||||
- name: sury.org repo requirements | |||||
apt: | |||||
pkg: | |||||
- apt-transport-https | |||||
- ca-certificates | |||||
- name: sury.org repo key | |||||
get_url: | |||||
url: https://packages.sury.org/php/apt.gpg | |||||
dest: /etc/apt/trusted.gpg.d/php.gpg | |||||
checksum: sha256:ace18406ecfe44292566bba8fc2d922370bc9531808a6319019bada3f7b3eab0 | |||||
- name: sury.org repo | |||||
apt_repository: | |||||
repo: deb https://packages.sury.org/php/ {{ansible_distribution_release}} main | |||||
filename: php | |||||
- name: ensure sury.org repo is not present | |||||
file: | |||||
path: /etc/apt/sources.list.d/php.list | |||||
state: absent | |||||
- when: not php_version is defined | |||||
block: | |||||
- name: debian php-cli package | |||||
apt: | |||||
pkg: php-cli | |||||
- name: get installed php version | |||||
command: php | |||||
args: | |||||
stdin: '<?php echo phpversion(); ?>' | |||||
register: _get_installed_php_version | |||||
changed_when: false | |||||
- set_fact: | |||||
php_version: "{{ _get_installed_php_version.stdout.split('.')[0:2]|join('.') }}" | |||||
- name: debian packages | |||||
apt: | |||||
pkg: | |||||
- php{{php_version}}-cli | |||||
- libapache2-mod-php{{php_version}} | |||||
- php{{php_version}}-xml | |||||
- php{{php_version}}-json | |||||
- php{{php_version}}-mbstring |
@@ -0,0 +1,7 @@ | |||||
opcache.enable=1 | |||||
opcache.enable_cli=1 | |||||
opcache.interned_strings_buffer=8 | |||||
opcache.max_accelerated_files=10000 | |||||
opcache.memory_consumption=128 | |||||
opcache.save_comments=1 | |||||
opcache.revalidate_freq=1 |