Skip to content
Snippets Groups Projects
Verified Commit 07f4f8a5 authored by Chris Croome's avatar Chris Croome
Browse files

check opcache.jit_buffer_size is 0 or >= 40960

parent 935e0c76
No related branches found
No related tags found
No related merge requests found
Pipeline #35152 passed
......@@ -78,7 +78,7 @@ php_config:
"opcache.enable": "1"
"opcache.interned_strings_buffer": "64"
# "opcache.jit": "tracing"
# "opcache.jit_buffer_size": "256"
# "opcache.jit_buffer_size": "40961" # minimum size is 40961 bytes
"opcache.jit": "0"
"opcache.jit_buffer_size": "0"
"opcache.max_accelerated_files": "100000"
......@@ -188,7 +188,7 @@ php_config:
"opcache.enable": "1"
"opcache.interned_strings_buffer": "64"
# "opcache.jit": "tracing"
# "opcache.jit_buffer_size": "256"
# "opcache.jit_buffer_size": "40961" # minimum size is 40961 bytes
"opcache.jit": "0"
"opcache.jit_buffer_size": "0"
"opcache.max_accelerated_files": "100000"
......@@ -298,7 +298,7 @@ php_config:
"opcache.enable": "1"
"opcache.interned_strings_buffer": "64"
# "opcache.jit": "tracing"
# "opcache.jit_buffer_size": "256"
# "opcache.jit_buffer_size": "40961" # minimum size is 40961 bytes
"opcache.jit": "0"
"opcache.jit_buffer_size": "0"
"opcache.max_accelerated_files": "100000"
......@@ -408,7 +408,7 @@ php_config:
"opcache.enable": "1"
"opcache.interned_strings_buffer": "64"
# "opcache.jit": "tracing"
# "opcache.jit_buffer_size": "256"
# "opcache.jit_buffer_size": "40961" # minimum size is 40961 bytes
"opcache.jit": "0"
"opcache.jit_buffer_size": "0"
"opcache.max_accelerated_files": "100000"
......
......@@ -66,6 +66,23 @@ argument_specs:
elements: str
required: false
description: A generated list of php configuration that is not absent.
php_conf_opcache_jit_buffer_sizes:
type: list
elements: str
required: false
description: A generated list of the opcache.jit_buffer_sizes.
php_conf_opcache_jit_buffer_sizes_jmespath_query:
type: str
required: true
description: A JMESPath query for the opcache.jit_buffer_sizes.
# php_conf_opcache_jit_buffer_sizes_jmespath_query1:
# type: str
# required: true
# description: A JMESPath query for the opcache.jit_buffer_sizes.
# php_conf_opcache_jit_buffer_sizes_jmespath_query2:
# type: str
# required: true
# description: A JMESPath query for the opcache.jit_buffer_sizes.
php_conf_pool_files_not_absent:
type: list
elements: str
......
......@@ -170,6 +170,28 @@
fail_msg: "Non unique PHP-FPM pool names:{% for php_pool_name in php_pool_names_not_absent %} {{ php_pool_name }}{% endfor %}, please run the role once with --extra-vars='php_fpm_pool_check_fail=false' to fix this"
when: php_fpm_pool_check_fail | bool
- name: Debug php_conf_opcache_jit_buffer_sizes_jmespath_query
ansible.builtin.debug:
var: php_conf_opcache_jit_buffer_sizes_jmespath_query
verbosity: "{% if ansible_check_mode | bool or ansible_diff_mode | bool %}1{% else %}2{% endif %}"
- name: Debug php_conf_opcache_jit_buffer_sizes
ansible.builtin.debug:
var: php_conf_opcache_jit_buffer_sizes
verbosity: "{% if ansible_check_mode | bool or ansible_diff_mode | bool %}1{% else %}2{% endif %}"
# https://github.com/composer/composer/issues/12153#issuecomment-2419452358
- name: Check that the opcache.jit_buffer_size is set to 0 or is >= 40961
ansible.builtin.assert:
that:
- php_conf_opcache_jit_buffer_size is ansible.builtin.regex('^[0-9]{1,20}$')
- ( php_conf_opcache_jit_buffer_size == "0" ) or ( php_conf_opcache_jit_buffer_size >= "40961" )
quiet: "{% if ansible_verbosity == 0 %}true{% else %}false{% endif %}"
loop: "{{ php_conf_opcache_jit_buffer_sizes }}"
loop_control:
loop_var: php_conf_opcache_jit_buffer_size
when: php_conf_opcache_jit_buffer_sizes != []
# TODO sapis are required when php_modules are set to be present
tags:
......
......@@ -96,6 +96,12 @@ php_conf_pool_files_not_absent: "{{ php_config | community.general.json_query('s
# cat defaults/main.yml | yq -o=json | jp "php_config[?state=='present'].files[]|[?state!='absent']"
php_conf_not_absent: "{{ php_config | community.general.json_query('[?state==`present`].files[]|[?state!=`absent`]') }}"
# PHP opcache jit buffer sizes
# cat defaults/main.yml | yq -o=json | \
# jp "php_config[?state=='present'].files[]|[?state!='absent'].conf.opcache.[\"opcache.jit_buffer_size\"]|[]"
php_conf_opcache_jit_buffer_sizes_jmespath_query: '[?state==`present`].files[]|[?state!=`absent`].conf.opcache.["opcache.jit_buffer_size"]|[]'
php_conf_opcache_jit_buffer_sizes: "{{ php_config | community.general.json_query(php_conf_opcache_jit_buffer_sizes_jmespath_query) }}"
# PHP modules configuration absent
# cat defaults/main.yml | yq -o=json | jp "sort(php_modules[?state=='absent'].version)"
php_mods_ver_absent: "{{ php_modules | community.general.json_query('sort([?state==`absent`].version)') }}"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment