# Jinga2  Integer substitution in YAML  task file

**URL:** <https://forum.ansible.com/t/jinga2-integer-substitution-in-yaml-task-file/15209>\
**Category:** Ansible Project\
**Created:** [May 12, 2014, 12:10pm UTC](https://forum.ansible.com/t/jinga2-integer-substitution-in-yaml-task-file/15209 "2014-05-12T12:10:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oliver\_Heinz](https://avatars.discourse-cdn.com/v4/letter/o/db5fbb/32.png) [@Oliver\_Heinz](https://forum.ansible.com/u/Oliver_Heinz)\
**Post date:** [May 12, 2014, 12:10pm UTC](https://forum.ansible.com/t/jinga2-integer-substitution-in-yaml-task-file/15209/1 "2014-05-12T12:10:46Z")

</div>

I have a group var definition:

vm\_disk\_size: 10

In the tasks main file I have the option (action is vsphere\_guest [http://docs.ansible.com/vsphere\_guest\_module.html](http://docs.ansible.com/vsphere_guest_module.html))

size\_gb: “{{ vm\_disk\_size|int }}”

The Error I get is:

msg: Config mismatch for vm\_disk on [(‘size\_gb’, \<type ‘int’\>)]

Leaving the int-Filter away makes no difference.

I guess this must be rather trivial, as this should be a common use case. But I don’t find the solution myself, so please push me in the right direction.

TIA,  
Oliver

ansible: 1.6.1

---

<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:** [May 12, 2014, 5:08pm UTC](https://forum.ansible.com/t/jinga2-integer-substitution-in-yaml-task-file/15209/2 "2014-05-12T17:08:59Z")

</div>

This sounds much more like the module is unhappy with the input for the vsphere module.

Please make sure there is a ticket on [github.com/ansible/ansible](http://github.com/ansible/ansible) and we can dig into this.

The version of the vsphere library you are using may also be relevant.

---

<div class="post-metadata">

**Author:** ![Oliver\_Heinz](https://avatars.discourse-cdn.com/v4/letter/o/db5fbb/32.png) [@Oliver\_Heinz](https://forum.ansible.com/u/Oliver_Heinz)\
**Post date:** [May 12, 2014, 5:29pm UTC](https://forum.ansible.com/t/jinga2-integer-substitution-in-yaml-task-file/15209/3 "2014-05-12T17:29:31Z")

</div>

If I give the same values without Jinga2 substitution everything works, fine?

size\_gb: 10

That’s what let me assume that it is not a problem in the module itself.

pysphere==0.1.8

Should I still file a bug?

---

<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:** [May 13, 2014, 3:31pm UTC](https://forum.ansible.com/t/jinga2-integer-substitution-in-yaml-task-file/15209/4 "2014-05-13T15:31:46Z")

</div>

This sounds entirely like the module is at fault and it doesn’t have anything to do with Jinja2.

What may be happening is the module is expecting an integer, and not casting strings to integers.

In which case, this could be quickly confirmed with:

size\_gb={{ some\_value | int }}

And to see if that fixes it.

Yes, I’d definitely like a bug. Thank you!
