# Ansible fact with dot, how to escape?

**URL:** <https://forum.ansible.com/t/ansible-fact-with-dot-how-to-escape/24019>\
**Category:** Ansible Project\
**Created:** [March 21, 2017, 8:00am UTC](https://forum.ansible.com/t/ansible-fact-with-dot-how-to-escape/24019 "2017-03-21T08:00:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nils\_Borrmann](https://avatars.discourse-cdn.com/v4/letter/n/cab0a1/32.png) [@Nils\_Borrmann](https://forum.ansible.com/u/Nils_Borrmann)\
**Post date:** [March 21, 2017, 8:00am UTC](https://forum.ansible.com/t/ansible-fact-with-dot-how-to-escape/24019/1 "2017-03-21T08:00:32Z")

</div>

Hi,

i’m trying to get the values of a fact with a dot.

For example this interface:

“ansible\_bond0.247”: {  
“active”: true,  
“device”: “bond0.247”,

…

{{ ansible\_bond0.247.device }}

doesn’t work, because ansible thinks that 247 is a subfact.

Any ideas how to do it?

Thanks 🙂  
Nils

---

<div class="post-metadata">

**Author:** ![Josh\_Smift1](https://avatars.discourse-cdn.com/v4/letter/j/bcef8e/32.png) [@Josh\_Smift1](https://forum.ansible.com/u/Josh_Smift1)\
**Post date:** [March 21, 2017, 1:51pm UTC](https://forum.ansible.com/t/ansible-fact-with-dot-how-to-escape/24019/2 "2017-03-21T13:51:24Z")

</div>

> {{ ansible\_bond0.247.device }}
> 
> doesn't work, because ansible thinks that 247 is a subfact.

Use the longer (but less hinky) Python style specification:

&nbsp;&nbsp;{{ ansible\_bond0['bond0.247']['device'] }}

That also lets you differentiate between literals (like bond0.247) and  
variables (e.g. if you had the interface name in a variable like  
my\_int\_name, you could do ansible\_bond0[my\_int\_name]['device'] and get the  
right thing), if you ever need to do that.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-Josh (jbs@care.com)

(apologies for the automatic corporate disclaimer that follows)

This email is intended for the person(s) to whom it is addressed and may contain information that is PRIVILEGED or CONFIDENTIAL. Any unauthorized use, distribution, copying, or disclosure by any person other than the addressee(s) is strictly prohibited. If you have received this email in error, please notify the sender immediately by return email and delete the message and any attachments from your system.
