# Vlan interfaces

**URL:** <https://forum.ansible.com/t/vlan-interfaces/14434>\
**Category:** Ansible Developer\
**Created:** [January 27, 2014, 9:57am UTC](https://forum.ansible.com/t/vlan-interfaces/14434 "2014-01-27T09:57:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jean-Pascal\_Tessier](https://avatars.discourse-cdn.com/v4/letter/j/c68b51/32.png) [@Jean-Pascal\_Tessier](https://forum.ansible.com/u/Jean-Pascal_Tessier)\
**Post date:** [January 27, 2014, 9:57am UTC](https://forum.ansible.com/t/vlan-interfaces/14434/1 "2014-01-27T09:57:20Z")

</div>

Hi,

Usually vlan interfaces have a ‘.’ in their names. So it isn’t possible to get information (like address) from jinja form because ‘.’ is used to access attributes.  
Instead of having vlan interface like a physical in facts, I suggest to have something like this:

“ansible\_eth2”: {  
“active”: true,  
“device”: “eth2”,  
“macaddress”: “00:11:22:33:44:55”,  
“module”: “ixgbe”,  
“mtu”: 1500,  
“promisc”: false,  
“type”: “ether”,  
“vlans”: {  
“2111”: {  
“device”: “eth2.2111”,  
“ipv4”: {  
“address”: “10.118.5.241”,  
“netmask”: “255.255.255.0”,  
“network”: “10.118.5.0”  
},  
“ipv4\_secondaries”:   
},  
“2112”: {  
“device”: “eth2.2112”,  
“ipv4”: {  
“address”: “10.118.6.241”,  
“netmask”: “255.255.255.0”,  
“network”: “10.118.6.0”  
},  
“ipv4\_secondaries”:   
}  
}  
}

What do you think about this ?

---

<div class="post-metadata">

**Author:** ![Tomasz\_Lesniewski](https://avatars.discourse-cdn.com/v4/letter/t/7ab992/32.png) [@Tomasz\_Lesniewski](https://forum.ansible.com/u/Tomasz_Lesniewski)\
**Post date:** [January 27, 2014, 10:47am UTC](https://forum.ansible.com/t/vlan-interfaces/14434/2 "2014-01-27T10:47:08Z")

</div>

Did you tried hostvars[‘hostname’][‘ansible\_eth2.2111’][‘ipv4’][‘address’]? It works fine for interfaces with ‘.’ in name.

---

<div class="post-metadata">

**Author:** ![Jean-Pascal\_Tessier](https://avatars.discourse-cdn.com/v4/letter/j/c68b51/32.png) [@Jean-Pascal\_Tessier](https://forum.ansible.com/u/Jean-Pascal_Tessier)\
**Post date:** [January 27, 2014, 1:40pm UTC](https://forum.ansible.com/t/vlan-interfaces/14434/3 "2014-01-27T13:40:06Z")

</div>

Yes I tried. It works fine when ‘hostname’ is an another host. If ‘hostname’ is the host on which playbook is running it becomes complex.
