Snmp_facts v3 get stuck after running ansible-playbook

Hi Everyone,

I was working with snmp_facts v2 module to gather a variety of facts from the cisco Switches. Now we migrated from snmp v2 to v3 on all switches that we administer. Thus, i tried to adjust the playbook in which i can gather the snmp-facts with v3.

The Problem now that the Playbook get stuck when it reaches the snmp-facts task.

Note: i did a snmp-walk from the terminal with v3 Credentials, it works fine.

I am using Ubuntu:

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION=“Ubuntu 22.04.5 LTS”
PRETTY_NAME=“Ubuntu 22.04.5 LTS”
NAME=“Ubuntu”
VERSION_ID=“22.04”
VERSION=“22.04.5 LTS (Jammy Jellyfish)”

Ansible Version:

ansible [core 2.17.14]
config file = /home/test/ansible.cfg
configured module search path = [‘/home/test/ntc-ansible’]
ansible python module location = /usr/local/lib/python3.10/dist-packages/ansible
ansible collection location = /home/test/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible
python version = 3.10.12 (main, Nov 4 2025, 08:48:33) [GCC 11.4.0] (/usr/bin/python3)
jinja version = 3.1.6
libyaml = True

The task in the Playbook:

  • name: Gather facts with SNMP version 3
    snmp_facts:
    host: ‘{{ inventory_hostname }}’
    version: v3
    level: authPriv
    integrity: sha
    privacy: aes
    username: xxxxxxxxxxxx
    authkey: xxxxxxxxxxxxxx
    privkey: xxxxxxxxxxxxxxx
    timeout: 5
    register: output1
    tags: create

Looking at the code for snmp_facts (community.general/plugins/modules/snmp_facts.py at 996b7469e5b01fa7ffd5ffc01a0de0a8b9b8a4cd · ansible-collections/community.general · GitHub), the SNMPv3 auth algorithms it supports are limited to md5 and sha and no support for SHA-2 variants .
I think If device is configured with snmp v3 using SHA-2 and if the playbook using integrity: sha will try SHA-1 instead. In that case the module can end in this statte.

I’d suggest double-checking the auth protocol configured on the device , and confirming whether it’s SHA-1 or SHA-2. If it’s SHA-2, this seems like a current limitation of snmp_facts, and it may be worth opening an enhancement request in community.general to add SHA-2 support.

Based on the switches (C2960x and C9200L) that we are deploying in our environment, sha 1 is the default configuration . On cisco switches we cant specify the sha version.