Problem with type conversion #17665
Labels
affects_2.1
This issue/PR affects Ansible v2.1
bug
This issue/PR relates to a bug.
support:core
This issue/PR relates to code supported by the Ansible Engineering Team.
ISSUE TYPE
COMPONENT NAME
Type conversion
ANSIBLE VERSION
Tried with the versions below:
ansible 2.1.0.0
config file =
configured module search path = Default w/o overrides
ansible 2.1.1.0
config file =
configured module search path = Default w/o overrides
OS / ENVIRONMENT
N/A
SUMMARY
I found this when I tried to override a variable. This variable have a "int" value and I tried to override with other "int" from a config yml file. I have an {% if variable == 27017 %} block which is evaluated as false because of the variable type.
STEPS TO REPRODUCE
I created a simple role to reproduce de problem. The role have a template named test_template.j2 with the following content:
Just a var inside the defaults/main.yml file:
The main.yml from tasks, which create a file good when is evaluated to true and wrong when is false :
A config.yml file with the value to override:
And a test.yml file:
EXPECTED RESULTS
The expected result will be al least two "good" files in the case 1 and 4, maybe in the iterate 3 too and a wrong file in the case of iterate 2.
ACTUAL RESULTS
We found just one "good" file good1 with the "27017 is not a string" content and three "wrong" files with the content "27017 is a string"
The text was updated successfully, but these errors were encountered: