Skip to content

Conversation

@gianmarco-mameli
Copy link
Contributor

Hello,
I’m using the collection on Ansible Core >= 2.19, and because of some changes on the playbook behavior handling the conditionals, some tasks fail with an error like:

TASK [netways.icinga.monitoring_plugins : Apt - install requested packages] ***************************************************************************************************************************************************************************************************************************************************
[ERROR]: Task failed: Conditional result (True) was derived from value of type 'list' at '/Users/user/.ansible/collections/ansible_collections/netways/icinga/roles/monitoring_plugins/tasks/main.yml:53:22'. Conditionals must have a boolean result.

Task failed.
Origin: /Users/user/.ansible/collections/ansible_collections/netways/icinga/roles/monitoring_plugins/tasks/install_on_Debian.yml:3:3

1 ---
2
3 - name: Apt - install requested packages
    ^ column 3

<<< caused by >>>

Conditional result (True) was derived from value of type 'list' at '/Users/user/.ansible/collections/ansible_collections/netways/icinga/roles/monitoring_plugins/tasks/main.yml:53:22'. Conditionals must have a boolean result.
Origin: /Users/user/.ansible/collections/ansible_collections/netways/icinga/roles/monitoring_plugins/tasks/install_on_Debian.yml:13:7

11   when:
12     - needed_packages is defined
13     - needed_packages
         ^ column 7

Broken conditionals can be temporarily allowed with the `ALLOW_BROKEN_CONDITIONALS` configuration option.

The doc reference Ansible Broken Conditionals
I’ve made some fixes, simply adding a length > 0 filter to the vars to be sure that on the when clause the result is a pure boolean
Let me know if that’s ok

Thanks

… Debian, RedHat, and Suse installation tasks
Copy link
Member

@Donien Donien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution! :)

I just reworded the changelog fragment since I cannot yet tell if there are other broken conditionals in the remaining roles (I'd expect so, though).

Also, I'll just commit into your branch for now and merge right away (another small point release in the pipeline already).

Also: #399

So, thanks again :)

@gianmarco-mameli
Copy link
Contributor Author

Ok thanks, If I find any other broken thing I just open dedicated PRs

@Donien Donien merged commit d0ea8f2 into NETWAYS:main Nov 10, 2025
@gianmarco-mameli gianmarco-mameli deleted the broken-conditionals-on-ansible-2.19 branch November 10, 2025 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants