New to the nornir and seeking for a lil bit of help.
What I’m trying to achive is to find stp root bridges and execute new tasks on the ones found.
Currently the approach I’m using is to save matches to root_bridges list.
Unable to figure out how could I filter inventory based on these results.
I’m a reinventing a wheel, is there a better way to do this?
def stp(): stp_result = nr.run(task=netmiko_send_command, command_string='show spanning-tree | inc This bridge is the root') root_bridges =  for i, u in stp_result.items(): if 'This bridge is the root' in u.result: root_bridges.append(i) print(root_bridges) -> ['SW1', 'SW2'] hosts.yaml --- SW1: hostname: 10.1.1.1 groups: - cisco data: type: network_device SW2: hostname: 10.1.1.2 groups: - cisco data: type: network_device