# Issue while applying a VLANed nic variable into a playbook

**URL:** <https://forum.ansible.com/t/issue-while-applying-a-vlaned-nic-variable-into-a-playbook/14952>\
**Category:** Ansible Project\
**Created:** [April 7, 2014, 11:59am UTC](https://forum.ansible.com/t/issue-while-applying-a-vlaned-nic-variable-into-a-playbook/14952 "2014-04-07T11:59:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sebastien\_Han](https://avatars.discourse-cdn.com/v4/letter/s/e95f7d/32.png) [@Sebastien\_Han](https://forum.ansible.com/u/Sebastien_Han)\
**Post date:** [April 7, 2014, 11:59am UTC](https://forum.ansible.com/t/issue-while-applying-a-vlaned-nic-variable-into-a-playbook/14952/1 "2014-04-07T11:59:47Z")

</div>

Hi all,

This seems to only happen with a vlan on top of a bond device.

The fact gathers the nic properly:

pouet1 | success \>\> {  
“ansible\_facts”: {  
“ansible\_bond1.2108”: {  
“active”: true,  
“device”: “bond1.2108”,  
“ipv4”: {  
“address”: “192.168.0.1”,  
“netmask”: “255.255.255.0”,  
“network”: “192.168.0.0”  
},  
“ipv6”: [  
{  
“address”: “fe80::b6b5:2fff:fe63:4e69”,  
“prefix”: “64”,  
“scope”: “link”  
}  
],  
“macaddress”: “b4:b5:2f:25:6e:90”,  
“mtu”: 1500,  
“promisc”: false,  
“type”: “ether”  
}  
},  
“changed”: false  
}

However while trying to use this variable inside a playbook like this:

- name: tell memcached what IP to listen on  
lineinfile: dest=/etc/memcached.conf regexp=“^-l” line=‘-l {{ ansible\_bond1.2108.ipv4.address }}’  
notify: restart memcached

I get the following in the memcached.conf:

-l {{ansible\_bond1.2108.ipv4.address}}

I’ve tried with another nic such as eth0 and it works like a charm.  
Am I hitting a bug?

Thanksin advance!

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [April 9, 2014, 1:38pm UTC](https://forum.ansible.com/t/issue-while-applying-a-vlaned-nic-variable-into-a-playbook/14952/2 "2014-04-09T13:38:02Z")

</div>

This is a question about variables with ‘illegal’ characters in them not being able to be accessed in short form.

I believe I also discussed this on GitHub previously, though the solution is just:

-l {{ hostvars[inventory\_hostname][“ansible\_bond1.2108”].ipv4.address }}

I believe I also left the ticket open and suggested we replace “.” with “\_” so it allows the fact to be accessed directly, though this would be a backwards incompatible change for those that had dots in interface names – it’s easier than needing to know the above.

---

<div class="post-metadata">

**Author:** ![Sebastien\_Han](https://avatars.discourse-cdn.com/v4/letter/s/e95f7d/32.png) [@Sebastien\_Han](https://forum.ansible.com/u/Sebastien_Han)\
**Post date:** [April 14, 2014, 3:38pm UTC](https://forum.ansible.com/t/issue-while-applying-a-vlaned-nic-variable-into-a-playbook/14952/3 "2014-04-14T15:38:21Z")

</div>

Yes we discussed that on Github as well.  
Thanks again Michael!
