ansible-collections / cisco.ios

Ansible Network Collection for Cisco IOS
GNU General Public License v3.0
261 stars 162 forks source link

IOS Facts module fails with "deleted" interface status #1057

Open aoforb opened 1 month ago

aoforb commented 1 month ago
SUMMARY

Running the below task fails

- name: Gather IOS facts
  cisco.ios.ios_facts:
    gather_subset: interfaces

image

image

ISSUE TYPE
COMPONENT NAME

IOS Facts

ANSIBLE VERSION
ansible [core 2.16.6]
  python version = 3.10.14 (main, Apr  6 2024, 18:45:05) [GCC 9.4.0]
  jinja version = 3.1.3
  libyaml = True
COLLECTION VERSION
Collection                               Version
---------------------------------------- -------
ansible.netcommon                        6.0.0  
ansible.posix                            1.5.4  
ansible.utils                            3.1.0  
cisco.ios                                6.1.3  
CONFIGURATION
N/A
OS / ENVIRONMENT

Ubuntu 22.02

STEPS TO REPRODUCE

Configure a sub interface on a Cisco 9300 switch running 17.09.04a, then negate it.

interface GigabitEthernet2/0/32
 no switchport
interface GigabitEthernet2/0/32.1874
no interface GigabitEthernet2/0/32.1874

Then run the task

- name: Gather IOS facts
  cisco.ios.ios_facts:
    gather_subset: interfaces
EXPECTED RESULTS

Ansible should ignore deleted interfaces or at least include within facts and mark as 'deleted'

Looks like the "GigabitEthernet2/0/32.1874" is used as a dict key and is missing from the final facts dict and failing on a KeyError exception.

Deleted interfaces are only cleared by rebooting the switch, its been this way for years so Ansible should account for this.

See here

and here

also here

ACTUAL RESULTS

See above