Summary
When running this playbook with Ansible v2.20.4+, the playbook fails if the default_web variable in the inventory is set as an integer (e.g., 1) instead of a boolean (true/false).
Error Output
[ERROR]: Task failed: Conditional result (True) was derived from value of type 'int' at '/Users/marco/Documents/ansible/workshop-docker/kasm/inventory:98:18'. Conditionals must have a boolean result.
The error originates from:
/roles/install_common/tasks/main.yml (around lines 18–22)
- When
default_web is set to 1, the following breaks:
- set_fact:
web_ip: ...
target_ip: ...
when: default_web
Ansible 2.20 now enforces that when: conditions must be boolean strictly, so 1 (int) is not accepted.
Steps to Reproduce
- Set
default_web: 1 in your inventory file.
- Run the playbook with Ansible 2.20.4 or later.
- Observe failure on tasks that use
when: default_web.
Solution
Update the inventory to use boolean syntax instead of integer:
Or if you do not wish to stick to a default, use:
Consider clarifying in docs/README that this field must now be a boolean, not int.
Environment
- Ansible version: 2.20.4
- kasmtech/ansible: latest
- OS: Any
Additional Context
This is due to new strictness in Ansible 2.20+ regarding conditionals and types.
Suggested fix:
- Update docs to indicate boolean required.
- Potentially coerce or cast
default_web in playbook for backwards compatibility (e.g., when: default_web | bool).
Summary
When running this playbook with Ansible v2.20.4+, the playbook fails if the
default_webvariable in the inventory is set as an integer (e.g.,1) instead of a boolean (true/false).Error Output
The error originates from:
/roles/install_common/tasks/main.yml(around lines 18–22)default_webis set to1, the following breaks:when:conditions must be boolean strictly, so1(int) is not accepted.Steps to Reproduce
default_web: 1in your inventory file.when: default_web.Solution
Update the inventory to use boolean syntax instead of integer:
Or if you do not wish to stick to a default, use:
Consider clarifying in docs/README that this field must now be a boolean, not int.
Environment
Additional Context
This is due to new strictness in Ansible 2.20+ regarding conditionals and types.
Suggested fix:
default_webin playbook for backwards compatibility (e.g.,when: default_web | bool).