Skip to content

Conversation

@Yethal
Copy link

@Yethal Yethal commented Sep 15, 2025

Ansible 2.19 requires values used in conditionals to be actual bools and not just values that can be coerced to a bool

@BackEndTea
Copy link

As a work around, you can add an ansible.cfg to your project, with the following lines. This will keep old behavior of accepting "true" instead of true.

[defaults]
ALLOW_BROKEN_CONDITIONALS=True

@chadek
Copy link

chadek commented Sep 27, 2025

It would be wonderfull if this can be merged soon so we can make a use of this role again

derhuerst added a commit to OpenDataVBB/gtfs-rt-infrastructure that referenced this pull request Sep 29, 2025
…odejs 🐛

This allows running the playbook with Ansible >= 2.19.

related: geerlingguy/ansible-role-nodejs#171
derhuerst added a commit to OpenDataVBB/gtfs-rt-infrastructure that referenced this pull request Sep 30, 2025
…odejs 🐛

This allows running the playbook with Ansible >= 2.19.

related: geerlingguy/ansible-role-nodejs#171
derhuerst added a commit to OpenDataVBB/gtfs-rt-infrastructure that referenced this pull request Sep 30, 2025
…odejs 🐛

This allows running the playbook with Ansible >= 2.19.

related: geerlingguy/ansible-role-nodejs#171
tasks/main.yml Outdated
NPM_CONFIG_PREFIX: "{{ npm_config_prefix }}"
NODE_PATH: "{{ npm_config_prefix }}/lib/node_modules"
NPM_CONFIG_UNSAFE_PERM: "{{ npm_config_unsafe_perm }}"
NPM_CONFIG_UNSAFE_PERM: "{{ npm_config_unsafe_perm | bool }}"
Copy link

Choose a reason for hiding this comment

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

This appears to do the opposite of what should be done? This is coercing what is now (by default) a bool to a bool. Presumably you want to coerce a bool to a string instead?

Copy link
Author

Choose a reason for hiding this comment

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

Coercing to string would cause the exact same issue we're trying to avoid here

Copy link

Choose a reason for hiding this comment

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

This line isn't a conditional. It's an environment variable.

Copy link
Author

Choose a reason for hiding this comment

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

You're right, fixed

tasks/main.yml Outdated
npm:
path: "{{ nodejs_package_json_path }}"
when: nodejs_package_json_path is defined and nodejs_package_json_path
when: nodejs_package_json_path is defined and nodejs_package_json_path | bool
Copy link

Choose a reason for hiding this comment

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

This should already be a bool too, I think?

Copy link
Author

Choose a reason for hiding this comment

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

It might be but doesn't have to, that's why we're coercing it

Copy link

Choose a reason for hiding this comment

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

Doesn't and make it a bool?

Copy link
Author

Choose a reason for hiding this comment

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

I added parentheses to make the intention here clearer

Copy link

Choose a reason for hiding this comment

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

Ohhh I totally misread this line, apologies. Seems like it would be better/clearer to check explicitly for an empty string? But, 🤷

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.

4 participants