cannot have . inside [] hostvars[inventory_hostname]['ansible_' + interface]['ipv4.address']
On Fri, Jan 29, 2016 at 12:36 PM, Dayton Jones <[email protected]> wrote: > Changing to this format results in: > > FAILED! => {"changed": false, "failed": true, "msg": > "AnsibleUndefinedVariable: 'dict object' has no attribute > u'ansible_eth1.ipv4.address'"} > > > yet if I check ansible_eth1 I see: > >> {u'macaddress': u'00:21:f6:f2:c1:21', u'pciid': u'vif-0', u'module': >> u'xen_netfront', u'mtu': 1500, u'device': u'eth1', u'promisc': False, >> u'ipv4': {u'broadcast': u'10.224.103.255', u'netmask': u'255.255.248.0', >> u'network': u'10.224.96.0', u'address': u'10.224.97.202'}, u'active': True, >> u'type': u'ether'} > > > > So the current template looks like this: > > {% for interface in ansible_interfaces if interface != 'lo' %} > {{ hostvars[inventory_hostname]['ansible_' + interface + '.ipv4.address'] }} > {{ lookup('dig', hostvars[inventory_hostname]['ansible_' + interface + > '.ipv4.address'] + '/PTR') }} > {% endfor %} > > I can't see anything wrong here, and the address is there and > available....any other thoughts? > > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/4c1c9a24-cf36-4ee1-add3-cddfa4f021c0%40googlegroups.com. > > For more options, visit https://groups.google.com/d/optout. -- Brian Coca -- 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAJ5XC8nuuDFs_tr6%3DT%3D4YT37Wm0aiemRknGE6U1vV3aRDHA8UQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
