From c181c7f6cdd739045b9e329fae9e1ad9bc5bf4d0 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 24 Sep 2025 10:48:23 +0200 Subject: [PATCH] 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 --- group_vars/all/05_webserver.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/group_vars/all/05_webserver.yml b/group_vars/all/05_webserver.yml index ae711fd0..116781e8 100644 --- a/group_vars/all/05_webserver.yml +++ b/group_vars/all/05_webserver.yml @@ -43,8 +43,8 @@ WEBSERVER_CPUS_EFFECTIVE: >- # - else → floor to int WEBSERVER_WORKER_PROCESSES: >- {{ - 1 if WEBSERVER_CPUS_EFFECTIVE < 1 - else (WEBSERVER_CPUS_EFFECTIVE | int) + 1 if (WEBSERVER_CPUS_EFFECTIVE | float) < 1 + else (WEBSERVER_CPUS_EFFECTIVE | float | int) }} # 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(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 }}