Jinga2 Integer substitution in YAML task file

65 views
Skip to first unread message

Oliver Heinz

unread,
May 12, 2014, 12:10:46 PM5/12/14
to ansible...@googlegroups.com
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

Michael DeHaan

unread,
May 12, 2014, 5:08:59 PM5/12/14
to ansible...@googlegroups.com
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.




--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/6562f8f7-067f-4b68-b266-36ddb4174c1b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Oliver Heinz

unread,
May 12, 2014, 5:29:31 PM5/12/14
to ansible...@googlegroups.com

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?

Michael DeHaan

unread,
May 13, 2014, 3:31:46 PM5/13/14
to ansible...@googlegroups.com
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!


Reply all
Reply to author
Forward
0 new messages