Hello,

I have a scenario where I have the vars/main.yml

/vars/main.yml
---
 a_port:
  - Ethernet1
  - Ethernet2

device_info:
 - { host: toDeviceA, ip_address: 192.168.1.1 }
 - { host: toDeviceB, ip_address: 192.168.2.1 }

I want to be able to populate a template file 

/templates/test.j2

interface {{% item.a_port %}}
ip address {{% item.device_info  %}}

The end output will be something like below:

interface ethernet1
 ip address 192.168.1.1
interface ethernet2
 ip address 192.168.2.1

in the tasks/main.yml I have tried the following and other types but can't 
get a good result

---


- name: G

  template: src=test.j2 dest=testNode-1.txt

  with_items: a_port

  with_items: device_info



I'd like some advice on how best to structure this loop.


Thanks




-- 
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/4348e0a6-510a-462a-baa7-ba939e88628d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to