Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ansible issue with if statement #102

Open
bsakweson opened this issue Apr 9, 2018 · 1 comment
Open

Ansible issue with if statement #102

bsakweson opened this issue Apr 9, 2018 · 1 comment

Comments

@bsakweson
Copy link

bsakweson commented Apr 9, 2018

Thanks for taking time to write put this together. I ran into this error:

fatal: [192.168.1.20]: FAILED! => {"msg": "Unexpected templating type error occurred on ({% if num_nodes >= 0 -%}{{ 90 * 1024 + num_nodes|int * nanny_memory_per_node}}Ki{%- else -%}90Mi{% endif -%}): '>=' not supported between instances of 'str' and 'int'"}

Ansible does like the comparison in this statement:

"{% if num_nodes >= 0 -%}{{ 90 * 1024 + num_nodes|int * nanny_memory_per_node}}Ki{%- else -%}90Mi{% endif -%}"

I believe it should be like this:

"{% if num_nodes | int >= 0 -%}{{ 90 * 1024 + num_nodes|int * nanny_memory_per_node}}Ki{%- else -%}90Mi{% endif -%}"
@bsakweson
Copy link
Author

I noticed there are many instances of this comparison in the code, maybe it is just because of my environment. I am using Jinja2.

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

No branches or pull requests

1 participant