variables converted to int

Hi,

I’m using the latest version of ansible.
I have a variable defined in my group_vars file as follows:

var_name: 01

When using it in a task - {{var_name}}, the value is 1 instead of 01.
I require the value to be as is without ansible trying to convert it to int.
I tried using {{var_name | string}} - with no success.

Is this a bug or is there away to force ansible to treat the variable value as is?

Thanks,
Moti.

Hi,

maybe try:
var_name: “01”

David

Hi David,

Thanks - this seems to help :slight_smile:

Moti.

Yep, this is NOT a bug but a feature, as you specified the variable as an int in the YAML, seeing it’s without quotes.