I have a variable file like below:

12.1.1.25: TAP1
12.1.1.26: TAP2
11.0.0.26: TAP3
11.0.0.27: TAP4
9.2.2.211: SAT1
9.2.2.212: SAT2
10.7.7.28: SAT3
10.7.7.29: SAT4


  layers:
    - name: MY_LAYER
      things_prod:
        - 12.1.1.25
        - 12.1.1.26
      things_dr:
        - 11.0.0.26
        - 11.0.0.27
      bgcolor:
        - '#AED6F1'


    - name: YR_LAYER
      things_prod:
        - 9.2.2.211
        - 9.2.2.212
        - 9.2.2.213
      things_dr:
        - 10.7.7.28
        - 10.7.7.29
        - 10.7.7.30
      bgcolor:
        - '#F9E79F'


I need help with jinja template that give me the below output:


<tr>MY_LAYER</tr>
<td>TAP1</td><td>TAP3</td>
file_12.1.1.25_11.0.0.26.txt
<td>TAP2</td><td>TAP4</td>
file_12.1.1.26_11.0.0.27.txt


<tr>YR_LAYER</tr>
<td>SAT1</td><td>SAT3</td>
file_9.2.2.211_10.7.7.28.txt
<td>SAT2</td><td>SAT4</td>
file_9.2.2.212_10.7.7.29.txt
<td>SAT3</td><td>SAT6</td>
file_9.2.2.213_10.7.7.30.txt

How can i have loop.index loop over both lists things_prod & things_dr 
simultaneaously for us to get say "file_12.1.1.25_11.0.0.26.txt" ?

Below is the approach I took so far:

{% for layer in layers %}
<tr>


{% for item in layer.things_prod %}
<td>vars[item]</td>                 <-- dont know how to get corresponding 
variable for things_dr 
file_{{ item }}_{{ item }}.txt      <-- dont know how to get corresponding 
variable for things_dr


{% endfor %}
</tr>
{% endfor %}

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/fa9de9eb-e7db-4f64-872c-6c0a127a9483%40googlegroups.com.

Reply via email to