Hopefully I worded this question correctly.
I have a group_vars file that defines the following:
etherchannels:
access2:
- channelnumber: 1
interfaces:
- FastEthernet 1/14
- FastEthernet 1/15
access1:
- channelnumber: 1
interfaces:
- FastEthernet 1/14
- FastEthernet 1/15
And my playbook looks like this:
- name: LAN Switches
hosts: access
tasks:
- name: config unused access ports
cisco.ios.ios_lag_interfaces:
config:
- name: "{{ item.channelnumber }}"
members:
- member: "{{ item.interface }}"
mode: on
loop: "{{ etherchannels[inventory_hostname] }}"
The expected outcome is:
- ansible will run through the task for each hostnames under etherchannels(access 1 and 2)
- for each hostnames it would run the "name" function, defining the etherchannel and then
- for each etherchannel it would run the "members" function and add every listed interface
So it would function something like this, assuming I added more etherchannels:
name: 1
members:
- member: FastEthernetX
mode: on
- member: FastEthernetY
mode: on
name: 2
members:
- member: FastEthernetZ
mode: on
- member: FastEthernetA
mode: on
I've tried to add a loop inside the "cisco.ios.ios_lag_interfaces" module command but no dice.