Skip to content

Fix broken conditionals: replace var|string with proper boolean checks#239

Open
mandre wants to merge 1 commit into
mainfrom
var-string-as-bool
Open

Fix broken conditionals: replace var|string with proper boolean checks#239
mandre wants to merge 1 commit into
mainfrom
var-string-as-bool

Conversation

@mandre

@mandre mandre commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Newer Ansible versions (2.17+) require 'when' conditionals to evaluate to a boolean, not a truthy string. The |string filter converts a value to its string representation but does not produce a boolean result.

Replace all 'var|string' conditionals with
'var | default('', true) | length > 0' (positive checks) and 'var | default('', true) | length == 0' (negated checks) to produce proper boolean results.

Newer Ansible versions (2.17+) require 'when' conditionals to evaluate
to a boolean, not a truthy string. The |string filter converts a value
to its string representation but does not produce a boolean result.

Replace all 'var|string' conditionals with
'var | default('', true) | length > 0' (positive checks) and
'var | default('', true) | length == 0' (negated checks) to produce
proper boolean results.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant