I knew it would be simple if I just asked! That worked perfectly! Thanks! -Mark
On Thursday, November 12, 2015 at 3:39:38 PM UTC-8, mto...@go2uti.com wrote: > > > This is something I have been struggling with for a while: a variable > whose name includes a variable. For instance, Ansible facts for a server > includes the following information on the network interfaces: > > "ansible_eth0": { > "active": true, > "device": "eth0", > "ipv4": { > "address": "10.105.12.24", > "netmask": "255.255.252.0", > "network": "10.105.12.0" > }, > "macaddress": "00:50:56:92:3c:b2", > "module": "vmxnet3", > "mtu": 1500, > "promisc": false, > "type": "ether" > }, > "ansible_eth1": { > "active": true, > "device": "eth1", > "ipv4": { > "address": "10.104.24.25", > "netmask": "255.255.255.248", > "network": "10.104.24.24" > }, > "macaddress": "00:50:56:92:6a:40", > "module": "vmxnet3", > "mtu": 1500, > "promisc": false, > "type": "ether" > }, > "ansible_interfaces": [ > "lo", > "eth1", > "eth0" > ], > > In a playbook, I want to walk through the list of interfaces and extract > information about each one: > > - debug: msg="interface = {{item}}, address = > {{ansible_{{item}}.ipv4.address}} > with_items: ansible_interfaces > when: 'item != "lo"' > > This, of course, does not work because of the nested delimiters. So how > do I call out something like this? > -Mark > > -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/61be5e76-3e03-46a6-8e39-327d1bb7e860%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.