Looping over l2_interfaces only show the interface name

96 views
Skip to first unread message

L. Jankok

unread,
Jan 20, 2022, 3:53:25 PM1/20/22
to ansible...@googlegroups.com
Hi,

In the past when I have used  ansible_network_resources.l2_interfaces it provided me with a dictionary. But now I am getting a class type list variable instead of a dictionary (which is odd). Therefore I am missing all those values like item.access, item.trunk etc.

I know I am missing something here. Your help  is much appreciated.

Below is the simple playbook I am using for a proof of concept.

---

 

- name: Gather Hardware Data

  cisco.ios.ios_facts:

    gather_subset: hardware

 

- name: Gather all Layer 2 Interfaces

  cisco.ios.ios_facts:

    gather_subset: min

    gather_network_resources: l2_interfaces

 

- name: Print one variable

  ansible.builtin.debug:

    var: item

  loop: "{{ ansible_network_resources.l2_interfaces | dict2items }}"

Reply all
Reply to author
Forward
0 new messages