# variables converted to int

**URL:** <https://forum.ansible.com/t/variables-converted-to-int/16105>\
**Category:** Ansible Project\
**Created:** [September 3, 2014, 10:39am UTC](https://forum.ansible.com/t/variables-converted-to-int/16105 "2014-09-03T10:39:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Moti\_Heller](https://avatars.discourse-cdn.com/v4/letter/m/d2c977/32.png) [@Moti\_Heller](https://forum.ansible.com/u/Moti_Heller)\
**Post date:** [September 3, 2014, 10:39am UTC](https://forum.ansible.com/t/variables-converted-to-int/16105/1 "2014-09-03T10:39:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![David\_Karban](https://avatars.discourse-cdn.com/v4/letter/d/90db22/32.png) [@David\_Karban](https://forum.ansible.com/u/David_Karban)\
**Post date:** [September 3, 2014, 10:40am UTC](https://forum.ansible.com/t/variables-converted-to-int/16105/2 "2014-09-03T10:40:43Z")

</div>

Hi,

maybe try:  
var\_name: “01”

David

---

<div class="post-metadata">

**Author:** ![Moti\_Heller](https://avatars.discourse-cdn.com/v4/letter/m/d2c977/32.png) [@Moti\_Heller](https://forum.ansible.com/u/Moti_Heller)\
**Post date:** [September 3, 2014, 11:07am UTC](https://forum.ansible.com/t/variables-converted-to-int/16105/3 "2014-09-03T11:07:06Z")

</div>

Hi David,

Thanks - this seems to help 🙂

Moti.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [September 3, 2014, 11:37am UTC](https://forum.ansible.com/t/variables-converted-to-int/16105/4 "2014-09-03T11:37:11Z")

</div>

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.
