# how to exclude . in facts key

**URL:** <https://forum.ansible.com/t/how-to-exclude-in-facts-key/15247>\
**Category:** Ansible Project\
**Created:** [May 15, 2014, 1:57pm UTC](https://forum.ansible.com/t/how-to-exclude-in-facts-key/15247 "2014-05-15T13:57:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![oliver\_bril](https://avatars.discourse-cdn.com/v4/letter/o/f9ae1b/32.png) [@oliver\_bril](https://forum.ansible.com/u/oliver_bril)\
**Post date:** [May 15, 2014, 1:57pm UTC](https://forum.ansible.com/t/how-to-exclude-in-facts-key/15247/1 "2014-05-15T13:57:16Z")

</div>

All,

Perhaps someone knows the answer for my problem:

I gather the facts of a machine and want to use it as variable in a template.  
As far as i know you just use {{ ansible\_eth0.ipv4.address }} to get the ip address of the interface eth0.

Now my problem, the interface has a dot (.) in it’s name.

So it is called: “ansible\_eth0.2” and now i have a problem because {{ ansible\_eth0.2.ipv4.address }} gives errors.  
I tried to exclude the dot in so many ways but now i’m stuck.

Any one got the solution for me?

Kind regards,  
Oliver.

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [May 15, 2014, 2:06pm UTC](https://forum.ansible.com/t/how-to-exclude-in-facts-key/15247/2 "2014-05-15T14:06:35Z")

</div>

Does escaping the “.” in the interface name work? If not, you can always revert back to regular python dictionary syntax, for example (from my system):

- hosts: localhost  
tasks:
- debug: msg=‘{{hostvars[inventory\_hostname][“ansible\_virbr0”].ipv4.address}}’

Outputs:

TASK: [debug msg=‘{{hostvars[inventory\_hostname][“ansible\_virbr0”].ipv4.address}}’] \*\*\*  
ok: [127.0.0.1] =\> {  
“msg”: “192.168.122.1”  
}

---

<div class="post-metadata">

**Author:** ![oliver\_bril](https://avatars.discourse-cdn.com/v4/letter/o/f9ae1b/32.png) [@oliver\_bril](https://forum.ansible.com/u/oliver_bril)\
**Post date:** [May 16, 2014, 6:22am UTC](https://forum.ansible.com/t/how-to-exclude-in-facts-key/15247/3 "2014-05-16T06:22:51Z")

</div>

James,

Escaping the dot didn’t work but below syntax did!!!  
Thanks, had tried a lot of possibilities but i probably not this one 🙂

Kind regards,  
Oliver.
