mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-09-24 11:06:24 +02:00
fix(webserver): ensure numeric casting for worker_processes and worker_connections
- Cast WEBSERVER_CPUS_EFFECTIVE to float before comparison to avoid 'AnsibleUnsafeText < int' type errors. - Ensure correct numeric coercion for pids_limit values. - This prevents runtime templating errors when rendering nginx config. Ref: https://chatgpt.com/share/68d3b047-56ac-800f-a73f-2fb144dbb7c4
This commit is contained in:
@@ -43,8 +43,8 @@ WEBSERVER_CPUS_EFFECTIVE: >-
|
|||||||
# - else → floor to int
|
# - else → floor to int
|
||||||
WEBSERVER_WORKER_PROCESSES: >-
|
WEBSERVER_WORKER_PROCESSES: >-
|
||||||
{{
|
{{
|
||||||
1 if WEBSERVER_CPUS_EFFECTIVE < 1
|
1 if (WEBSERVER_CPUS_EFFECTIVE | float) < 1
|
||||||
else (WEBSERVER_CPUS_EFFECTIVE | int)
|
else (WEBSERVER_CPUS_EFFECTIVE | float | int)
|
||||||
}}
|
}}
|
||||||
|
|
||||||
# worker_connections from pids_limit (use the smaller one), with correct key/defaults
|
# worker_connections from pids_limit (use the smaller one), with correct key/defaults
|
||||||
@@ -52,7 +52,7 @@ WEBSERVER_WORKER_CONNECTIONS: >-
|
|||||||
{{
|
{{
|
||||||
[
|
[
|
||||||
(applications | resource_filter('svc-prx-openresty', 'pids_limit', service_name | default(''), RESOURCE_PIDS_LIMIT)) | int,
|
(applications | resource_filter('svc-prx-openresty', 'pids_limit', service_name | default(''), RESOURCE_PIDS_LIMIT)) | int,
|
||||||
(applications | resource_filter(application_id, 'pids_limit', service_name | default(''), RESOURCE_PIDS_LIMIT)) | int
|
(applications | resource_filter(application_id, 'pids_limit', service_name | default(''), RESOURCE_PIDS_LIMIT)) | int
|
||||||
] | min
|
] | min
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user