When I run this in ansible I pull a list of interfaces off a network switch.

---
- name: show interfaces
  hosts: all
  connection: network_cli
  gather_facts: no
  vars:
     ansible_network_os: ios

  tasks:

    - name: test
      ios_facts:
        gather_subset:
        - 'min'
        gather_network_resources:
        - l2_interfaces
 
Some examples from the result

{
                    "name": "GigabitEthernet1/0/13",
                    "access": {
                        "vlan": 3456
                    }
                },

                {
                    "name": "GigabitEthernet1/0/20",
                    "trunk": {
                        "allowed_vlans": [
                            "32",
                            "1978",
                            "1980",
                            "3456"
                        ]
                    }

What I would like to do is make a dictionary or list of interfaces based on 
either trunk or access and then what access vlan the interface is 
configured for.

Has anyone in this group tried this before and could help me out with this?

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/37b04c8e-3b54-4e43-ab13-668d4804f9c3n%40googlegroups.com.

Reply via email to