cisco.nxos
cisco.nxos copied to clipboard
snmp-server host failure on some switches versions only
SUMMARY
first issue : failing on "net_version": "7.0(3)I7(8)", but working on "net_version": "9.3(8)", when duplicate entries in conf for host
snmp-server host 192.168.0.1 informs version 3 auth snmp-user
snmp-server host 192.168.0.1 use-vrf default
task is failing
fatal: [targethost]: FAILED! => {"changed": false, "module_stderr": "no snmp-server host 192.168.0.1 use-vrf defaults\r\r\nhost not found\r\n\rTARGETHOST(config)# ", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error"}
when executed directly on a 7.0(3)I7(8) switch :
no snmp-server host 192.168.0.1 informs version 3 auth snmp-user
no snmp-server host 192.168.0.1 use-vrf default
same error :
host not found
but the error on a "9.3(8)" witch is different :
DME DNSUB: No such SNMP target configured.
and then the ansible task is not failing.
workaround use retries until all the duplicates are removed. task is failing. but the host is still deleted.
Issue number 2 :
I just noticed that there is no user "auth" entry in the output dict of the facts ... but just for the switch on version "9.3(8)" I did not notice any failure nor bugs due to this.
ISSUE TYPE
- Bug Report
COMPONENT NAME
snmp-server
ANSIBLE VERSION
ansible [core 2.12.5]
COLLECTION VERSION
cisco.nxos 3.0.0
STEPS TO REPRODUCE
add two entries on config like :
snmp-server host 192.168.0.1 informs version 3 auth snmp-user
snmp-server host 192.168.0.1 use-vrf default
then execute the task with state overriden
EXPECTED RESULTS
"commands": [
"no snmp-server host 192.168.0.1 informs version 3 auth snmp-user",
"no snmp-server host 192.168.0.1 use-vrf default",
]
ACTUAL RESULTS
fatal: [targethost]: FAILED! => { "changed": false, "module_stderr": "no snmp-server host 192.168.0.1 use-vrf default\r\r\nhost not found\r\n\rTARGETHOST(config)# ", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error" }
<10.72.1.4> ANSIBLE_NETWORK_IMPORT_MODULES: found cisco.nxos.nxos_snmp_server at ~/dev/ansible/collections/ansible_collections/cisco/nxos/plugins/modules/nxos_snmp_server.py
<10.72.1.4> ANSIBLE_NETWORK_IMPORT_MODULES: running cisco.nxos.nxos_snmp_server
<10.72.1.4> ANSIBLE_NETWORK_IMPORT_MODULES: complete
@tin-ot Hi! Could you please share the task which triggers these issues with state: overridden
?
- name: snmp nxos, override SNMP servers conf
cisco.nxos.nxos_snmp_server:
config:
location: "{{ snmp_server.location | default(omit) }}"
contact: "{{ snmp_server.contact | default(omit) }}"
drop:
unknown_user: true
users:
auth:
- user: snmp-user1
group: network-admin
authentication:
algorithm: sha
password: "{{ pwd }}"
priv:
privacy_password: "{{ priv }}"
aes_128: true
localized_key: false
- user: snmp-user2
group: network-admin
authentication:
algorithm: sha
password: "{{ pwd }}"
priv:
privacy_password: "{{ priv }}"
aes_128: true
localized_key: false
- user: snmp-user3
group: network-admin
authentication:
algorithm: sha
password: "{{ pwd }}"
priv:
privacy_password: "{{ priv }}"
aes_128: true
localized_key: false
use_acls:
- user: snmp-user1
ipv4: "{{ acl_num }}"
- user: snmp-user2
ipv4: "{{ acl_num }}"
- user: snmp-user3
ipv4: "{{ acl_num }}"
state: overridden
If I remember the issue 1 correctly, task fails , but still manages to delete one of the dups.
We are trying to remove this line :
snmp-server host 192.168.0.1 use-vrf default
while it was already removed with this line:
no snmp-server host 192.168.0.1 informs version 3 auth snmp-user
Thus, there is a non failing "warning" on some appliances, but a failing "error" in others.
About issue n2, sry I don't recall anything ^^.
@tin-ot Regarding the first issue, I'm able to reproduce it. In 7.0.3(x), it returns "host not found", in 9.x, it returns DME DNSUB: No such SNMP target configured.
. Ansible is able to identify the first one as an error, but not the second one.
However, I'm unsure about what your expected results are. Could you please elaborate a bit more on that? Thank you!