Where does interfaces_per_speed come from? Can you post all the data/vars/etc?
On Mon, 29 Mar 2021 at 10:16, [email protected] <[email protected]> wrote: > > > I have some issues with my project. I need to bond two interfaces, > automatically choosing the two with 25Gbit speed. I'm able to make a normal > bonding selecting the interface names, I'm able to filter the interfaces > through speed too, but I'm lost trying to connect both ideas. > > This is my Bonding.yml > > --- > > - name: Configure team interface > > hosts: vhost3 > > user: root > > vars: network_connections: > > - name: bond0 > > state: up > > type: bond > > interface_name: bond0 > > mtu: 9000 > > - name: bond0-ens2f0 > > state: up > > type: ethernet > > interface_name: ens2f0 > > master: bond0 > > - name: bond0-ens2f1 > > state: up > > type: ethernet > > interface_name: ens2f1 > > master: bond0 > > - name: bond0.121 > > state: up > > type: vlan > > parent: bond0 > > vlan: id: 121 > > interface_name: bond0.121 > > ip: address: > > - 10.1.xx.xxx/24 > > mtu: 9000 > > And with this tasks I can filter and list the interfaces with 25Gbit speed. > > - name: Show the result 3 > > set_fact: > > filter_interfaces: "{{interfaces_per_speed | selectattr('speed', '==', > 25000) | list }}" > > - name: Show the result 4 > > debug: > > msg: "{{filter_interfaces[0].interfaces}}" > > How can I do, so instead of saying example interface_name: ens2f0, it > automatically recognizes and chooses interfaces with 25Gbit? > > -- > 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/6b2a0530-de84-4d65-bd52-d70ca98ff651n%40googlegroups.com. -- Dick Visser Trust & Identity Service Operations Manager GÉANT -- 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/CAL8fbwOMdF9wmCAMcCncDBL1vzkEwYSdySCZFV_Fsdg_JRq%3DHQ%40mail.gmail.com.
