What is the easiest way using jinja2 (being called from ansible template function) to do a loop in a loop that will start with the first switch port and loop (count) to the last switch port and then continue to the next switch and do the same iteration?
Any tips would be greating appreciated!
Sample variables:
switches:
- name: "switch1"
first_port: "1"
last_port: "52"
- name: "switch2"
first_port: "1"
last_port: "48"
- name: "switch3"
first_port: "1"
last_port: "24"
Desired J2 template output:
switch1:
port:1
port:2
...
port:52
switch2:
port:1
port:2
...
port:48
switch3:
port:1
port:2
...
port:24