mirror of
https://github.com/geerlingguy/ansible-role-php.git
synced 2025-02-18 01:31:46 +01:00
PR #131 follow-up: Formatting and task reorganization.
This commit is contained in:
parent
f838f3fa5b
commit
7ed52a26c8
37
tasks/configure-apcu.yml
Normal file
37
tasks/configure-apcu.yml
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
---
|
||||||
|
- name: Check for existing APCu config files.
|
||||||
|
find:
|
||||||
|
paths: "{{ item }}"
|
||||||
|
contains: 'extension(\s+)?=(\s+)?apc[u]?\.so'
|
||||||
|
register: php_installed_apc_confs
|
||||||
|
with_items: "{{ php_extension_conf_paths }}"
|
||||||
|
|
||||||
|
- name: Remove any non-role-supplied APCu config files.
|
||||||
|
file:
|
||||||
|
path: "{{ item.1.path }}"
|
||||||
|
state: absent
|
||||||
|
when: php_apc_conf_filename != (item.1.path.split('/') | last)
|
||||||
|
with_subelements:
|
||||||
|
- "{{ php_installed_apc_confs.results }}"
|
||||||
|
- files
|
||||||
|
notify: restart webserver
|
||||||
|
|
||||||
|
- name: Ensure APCu config file is present.
|
||||||
|
template:
|
||||||
|
src: apc.ini.j2
|
||||||
|
dest: "{{ item }}/{{ php_apc_conf_filename }}"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
force: yes
|
||||||
|
mode: 0644
|
||||||
|
with_items: "{{ php_extension_conf_paths }}"
|
||||||
|
when: php_enable_apc
|
||||||
|
notify: restart webserver
|
||||||
|
|
||||||
|
- name: Remove APCu config file if APC is disabled.
|
||||||
|
file:
|
||||||
|
path: "{{ item }}/{{ php_apc_conf_filename }}"
|
||||||
|
state: absent
|
||||||
|
with_items: "{{ php_extension_conf_paths }}"
|
||||||
|
when: not php_enable_apc
|
||||||
|
notify: restart webserver
|
37
tasks/configure-opcache.yml
Normal file
37
tasks/configure-opcache.yml
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
---
|
||||||
|
- name: Check for existing OpCache config files.
|
||||||
|
find:
|
||||||
|
paths: "{{ item }}"
|
||||||
|
contains: 'zend_extension(\s+)?=(\s+)?opcache\.so'
|
||||||
|
register: php_installed_opcache_confs
|
||||||
|
with_items: "{{ php_extension_conf_paths }}"
|
||||||
|
|
||||||
|
- name: Remove any non-role-supplied OpCache config files.
|
||||||
|
file:
|
||||||
|
path: "{{ item.1.path }}"
|
||||||
|
state: absent
|
||||||
|
when: php_opcache_conf_filename != (item.1.path.split('/') | last)
|
||||||
|
with_subelements:
|
||||||
|
- "{{ php_installed_opcache_confs.results }}"
|
||||||
|
- files
|
||||||
|
notify: restart webserver
|
||||||
|
|
||||||
|
- name: Ensure OpCache config file is present.
|
||||||
|
template:
|
||||||
|
src: opcache.ini.j2
|
||||||
|
dest: "{{ item }}/{{ php_opcache_conf_filename }}"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
force: yes
|
||||||
|
mode: 0644
|
||||||
|
with_items: "{{ php_extension_conf_paths }}"
|
||||||
|
when: php_opcache_enable
|
||||||
|
notify: restart webserver
|
||||||
|
|
||||||
|
- name: Remove OpCache config file if OpCache is disabled.
|
||||||
|
file:
|
||||||
|
path: "{{ item }}/{{ php_opcache_conf_filename }}"
|
||||||
|
state: absent
|
||||||
|
with_items: "{{ php_extension_conf_paths }}"
|
||||||
|
when: not php_opcache_enable
|
||||||
|
notify: restart webserver
|
@ -18,77 +18,3 @@
|
|||||||
with_items: "{{ php_conf_paths }}"
|
with_items: "{{ php_conf_paths }}"
|
||||||
notify: restart webserver
|
notify: restart webserver
|
||||||
when: php_use_managed_ini
|
when: php_use_managed_ini
|
||||||
|
|
||||||
- name: Check for PHP-installed APCu configuration file(s)
|
|
||||||
find:
|
|
||||||
paths: "{{ item }}"
|
|
||||||
contains: 'extension(\s+)?=(\s+)?apc[u]?\.so'
|
|
||||||
register: php_installed_apc_confs
|
|
||||||
with_items: "{{ php_extension_conf_paths }}"
|
|
||||||
|
|
||||||
- name: Remove any PHP-installed APCu configuration files in favor of role configuration
|
|
||||||
file:
|
|
||||||
path: "{{ item.1.path }}"
|
|
||||||
state: absent
|
|
||||||
when: php_apc_conf_filename != (item.1.path.split('/') | last)
|
|
||||||
with_subelements:
|
|
||||||
- "{{ php_installed_apc_confs.results }}"
|
|
||||||
- files
|
|
||||||
notify: restart webserver
|
|
||||||
|
|
||||||
- name: Place APCu configuration file in place.
|
|
||||||
template:
|
|
||||||
src: apc.ini.j2
|
|
||||||
dest: "{{ item }}/{{ php_apc_conf_filename }}"
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
force: yes
|
|
||||||
mode: 0644
|
|
||||||
with_items: "{{ php_extension_conf_paths }}"
|
|
||||||
when: php_enable_apc
|
|
||||||
notify: restart webserver
|
|
||||||
|
|
||||||
- name: Remove APCu configuration file if disabled
|
|
||||||
file:
|
|
||||||
path: "{{ item }}/{{ php_apc_conf_filename }}"
|
|
||||||
state: absent
|
|
||||||
with_items: "{{ php_extension_conf_paths }}"
|
|
||||||
when: not php_enable_apc
|
|
||||||
notify: restart webserver
|
|
||||||
|
|
||||||
- name: Check for PHP-installed OpCache configuration file(s)
|
|
||||||
find:
|
|
||||||
paths: "{{ item }}"
|
|
||||||
contains: 'zend_extension(\s+)?=(\s+)?opcache\.so'
|
|
||||||
register: php_installed_opcache_confs
|
|
||||||
with_items: "{{ php_extension_conf_paths }}"
|
|
||||||
|
|
||||||
- name: Remove any PHP-installed OpCache configuration files in favor of role configuration
|
|
||||||
file:
|
|
||||||
path: "{{ item.1.path }}"
|
|
||||||
state: absent
|
|
||||||
when: php_opcache_conf_filename != (item.1.path.split('/') | last)
|
|
||||||
with_subelements:
|
|
||||||
- "{{ php_installed_opcache_confs.results }}"
|
|
||||||
- files
|
|
||||||
notify: restart webserver
|
|
||||||
|
|
||||||
- name: Place OpCache configuration file in place.
|
|
||||||
template:
|
|
||||||
src: opcache.ini.j2
|
|
||||||
dest: "{{ item }}/{{ php_opcache_conf_filename }}"
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
force: yes
|
|
||||||
mode: 0644
|
|
||||||
with_items: "{{ php_extension_conf_paths }}"
|
|
||||||
when: php_opcache_enable
|
|
||||||
notify: restart webserver
|
|
||||||
|
|
||||||
- name: Remove OpCache configuration file if disabled
|
|
||||||
file:
|
|
||||||
path: "{{ item }}/{{ php_opcache_conf_filename }}"
|
|
||||||
state: absent
|
|
||||||
with_items: "{{ php_extension_conf_paths }}"
|
|
||||||
when: not php_opcache_enable
|
|
||||||
notify: restart webserver
|
|
||||||
|
@ -56,6 +56,6 @@
|
|||||||
|
|
||||||
# Configure PHP.
|
# Configure PHP.
|
||||||
- include: configure.yml
|
- include: configure.yml
|
||||||
|
- include: configure-apcu.yml
|
||||||
# Configure PHP-FPM.
|
- include: configure-opcache.yml
|
||||||
- include: configure-fpm.yml
|
- include: configure-fpm.yml
|
||||||
|
Loading…
Reference in New Issue
Block a user