Sorry if this already being asked before, but I can't find any solution that match my problem.
I'm trying to convert the string that I have to convert to an integer:
- hosts: myhost
vars:
- variable1: 15
- variable2: "15"
- variable3: "{{ variable2 | int }}"
I tried to use variable2 (string) for calculation, so I convert it to int in variable3. But it failed with error message
"Unexpected templating type error occurred on ({{ variable3 + 1 }}): coercing to Unicode: need string or buffer, int found"
So, I tried to use type_debug to find out each type of the 3 variable listed.
variable1isintvariable2isansibleunicodevariable3isunicode
I don't understand the difference between ansibleunicode and unicode or why it is listed as unicode instead of integer when I already convert it from string to integer using | int.
What should I do?