Jinja template cannot fetch '0.10' value

1 view
Skip to first unread message

dudu.c...@gmail.com

unread,
Oct 24, 2023, 5:46:43 AM10/24/23
to Ansible Project

Hi,

I have input file that include the following parameter.

internal_network_reverse: 0.10

 

and a jinja template file that include the following line

zone "{{ internal_network_reverse | default ('168.192') }}.in-addr.arpa"

 

 

The required output I wish to get is zone "0.10.in-addr.arpa"

Instead, I’m getting this zone "0.1.in-addr.arpa"  ; Without the zero

 

I have tried using string and float but still I’m not getting the required result.

zone "{{ internal_network_reverse | string | default ('168.192') }}.in-addr.arpa"

zone "{{ internal_network_reverse | float | default ('168.192') }}.in-addr.arpa"

 

Any suggestions??

*Please note that I don’t want to add “ “ in my input file - this way it is working but I need to avoid the use of “ “ 

Dick Visser

unread,
Oct 24, 2023, 6:25:01 AM10/24/23
to ansible...@googlegroups.com
If your input is supposed to be yaml, then the 0.10 value will be interpreted as a float. 
If you want it to be a string, you have to quote it (although you don't want to).

It cannot be two types at the same time 


Sent from Gmail Mobile


--
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 view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/7d07272f-c396-465d-931c-381c2a4e92a7n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages