variables converted to int

48 views
Skip to first unread message

Moti Heller

unread,
Sep 3, 2014, 6:39:08 AM9/3/14
to ansible...@googlegroups.com
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.

David Karban

unread,
Sep 3, 2014, 6:41:04 AM9/3/14
to ansible...@googlegroups.com
Hi,

maybe try:
var_name: "01"

David


--
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/aca8f209-a59b-4e2b-a992-32923226ef3f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
David Karban
Specialista na správu linuxových serverů
www.karban.eu

Moti Heller

unread,
Sep 3, 2014, 7:07:06 AM9/3/14
to ansible...@googlegroups.com
Hi David,

Thanks - this seems to help :)

Moti.

Michael DeHaan

unread,
Sep 3, 2014, 7:37:21 AM9/3/14
to ansible...@googlegroups.com
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.



Reply all
Reply to author
Forward
0 new messages