Jinga2 Integer substitution in YAML task file

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)

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

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 and we can dig into this.

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

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?

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!