# net\_neighbors

**URL:** <https://forum.ansible.com/t/net-neighbors/33735>\
**Category:** Ansible Project\
**Created:** [September 3, 2020, 7:00am UTC](https://forum.ansible.com/t/net-neighbors/33735 "2020-09-03T07:00:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jaime\_Jaca](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@Jaime\_Jaca](https://forum.ansible.com/u/Jaime_Jaca)\
**Post date:** [September 3, 2020, 7:00am UTC](https://forum.ansible.com/t/net-neighbors/33735/1 "2020-09-03T07:00:08Z")

</div>

I would like to filter the neighbors to only show switches and routers

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [September 3, 2020, 10:03am UTC](https://forum.ansible.com/t/net-neighbors/33735/2 "2020-09-03T10:03:35Z")

</div>

Playbooks, examples, etc will help in getting an answer with so little context

---

<div class="post-metadata">

**Author:** ![Jaime\_Jaca](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@Jaime\_Jaca](https://forum.ansible.com/u/Jaime_Jaca)\
**Post date:** [September 3, 2020, 10:25am UTC](https://forum.ansible.com/t/net-neighbors/33735/3 "2020-09-03T10:25:50Z")

</div>

With this playbook it shows the ports and the neighbors connected by cdp or lldp (sw, routers, telephones, aps …). I would like it to only show sw and routers.

tasks:

- name: GATHER FACTS FOR IOS IN A TASK  
ios\_facts:

- name: VIEW ALL ANSIBLE FACT KEYS  
debug:  
var: ansible\_facts.keys()

- name: View HOSTNAME  
debug:  
var: ansible\_net\_hostname

- name: View Neighbors  
debug:  
var: ansible\_net\_neighbors
