cisco.nxos
cisco.nxos copied to clipboard
Nxos User Module Issue
SUMMARY
The following module fails nxos_snmp_user
- name: Configure Admin User
nxos_snmp_user:
user: admin
group: "{{ item.context }}"
authentication: "{{ item.authentication }}"
encrypt: "{{ item.encrypt }}"
privacy: "{{ localpassword }}"
pwd: "{{ localpassword }}"
state: present
changed_when: false
with_items:
- "{{ snmp_user }}"
no_log: false
tags:
- nxos-snmp
ISSUE TYPE
- Bug Report
COMPONENT NAME
nxos_snmp_user
ANSIBLE VERSION
ansible 2.10.4 config file = /home/feisa/ansible-network/ansible.cfg configured module search path = ['/home/feisa/ansible-network/library'] ansible python module location = /home/feisa/.local/lib/python3.6/site-packages/ansible executable location = /usr/local/bin/ansible python version = 3.6.8 (default, Aug 18 2020, 08:33:21) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]
CONFIGURATION
COLLECTIONS_PATHS(/home/feisa/ansible-network/ansible.cfg) = ['/home/feisa/ansible-network/collections'] DEFAULT_ACTION_PLUGIN_PATH(/home/feisa/ansible-network/ansible.cfg) = ['/usr/local/lib/python3.6/site-packages/ara/plugins/action'] DEFAULT_CALLBACK_PLUGIN_PATH(/home/feisa/ansible-network/ansible.cfg) = ['/usr/local/lib/python3.6/site-packages/ara/plugins/callback'] DEFAULT_FORKS(/home/feisa/ansible-network/ansible.cfg) = 100 DEFAULT_HOST_LIST(/home/feisa/ansible-network/ansible.cfg) = ['/home/feisa/ansible-network/inventories'] DEFAULT_MODULE_PATH(/home/feisa/ansible-network/ansible.cfg) = ['/home/feisa/ansible-network/library'] DEFAULT_ROLES_PATH(/home/feisa/ansible-network/ansible.cfg) = ['/home/feisa/ansible-network/roles'] DEFAULT_SCP_IF_SSH(/home/feisa/ansible-network/ansible.cfg) = True GALAXY_SERVER_LIST(/home/feisa/ansible-network/ansible.cfg) = ['automation_hub', 'release_galaxy'] HOST_KEY_CHECKING(/home/feisa/ansible-network/ansible.cfg) = False INTERPRETER_PYTHON(/home/feisa/ansible-network/ansible.cfg) = auto PERSISTENT_COMMAND_TIMEOUT(/home/feisa/ansible-network/ansible.cfg) = 60000000 PERSISTENT_CONNECT_RETRY_TIMEOUT(/home/feisa/ansible-network/ansible.cfg) = 100 PERSISTENT_CONNECT_TIMEOUT(/home/feisa/ansible-network/ansible.cfg) = 6000
OS / ENVIRONMENT
bootflash:///m9100-s5ek9-mz.8.4.1.bin
STEPS TO REPRODUCE
- name: Configure Admin User
nxos_snmp_user:
user: admin
group: "{{ item.context }}"
authentication: "{{ item.authentication }}"
encrypt: "{{ item.encrypt }}"
privacy: "{{ localpassword }}"
pwd: "{{ localpassword }}"
state: present
changed_when: false
with_items:
- "{{ snmp_user }}" no_log: false tags:
- nxos-snmp
EXPECTED RESULTS
n/a
ACTUAL RESULTS
@feisa You have not shared the value of the variables you've used in the task. However, the following playbook worked fine for me.
- hosts: nxos
gather_facts: false
vars:
localpassword: testpassword_1
snmp_user:
- context: network-operator
authentication: md5
encrypt: True
tasks:
- name: Configure Admin User
cisco.nxos.nxos_snmp_user:
user: admin
group: "{{ item.context }}"
authentication: "{{ item.authentication }}"
encrypt: "{{ item.encrypt }}"
privacy: "{{ localpassword }}"
pwd: "{{ localpassword }}"
state: present
changed_when: false
with_items:
- "{{ snmp_user }}"
no_log: false
tags:
- nxos-snmp
We would need the snmp_user
list that the given task iterates through and the value of the localpassword
variable to debug this further.
We used the following
snmp_user:
- { user: snmp, context: network-admin, authentication: sha, encrypt: yes, hash: 0x9cadd1b57db137ade7b342348ff2274aed30810 }
- { user: admin, context: network-admin, authentication: sha, encrypt: yes, hash: 0x9cadd1b57db137ade7b23424242244aed30810 }
locapassword is a vaulted password of random 15 character alpha numeric
I have a slight work around on this so if we could prioritize my other issues that would be better
Even with the information you shared, I am unable to reproduce the traceback you're hitting with the following playbook:
---
- hosts: nxos
gather_facts: false
vars:
localpassword: M0L5pU#rhp8I9^2
snmp_user:
- { user: snmp, context: network-admin, authentication: sha, encrypt: yes, hash: 0x9cadd1b57db137ade7b342348ff2274aed30810 }
- { user: admin, context: network-admin, authentication: sha, encrypt: yes, hash: 0x9cadd1b57db137ade7b23424242244aed30810 }
tasks:
- name: Configure Admin User
cisco.nxos.nxos_snmp_user:
user: "{{ item.user }}"
group: "{{ item.context }}"
authentication: "{{ item.authentication }}"
encrypt: "{{ item.encrypt }}"
privacy: "{{ localpassword }}"
pwd: "{{ localpassword }}"
state: present
changed_when: false
with_items:
- "{{ snmp_user }}"
no_log: false
tags:
- nxos-snmp
I am using ansible-base==2.10.4 and the latest cisco.nxos collection with Python 3.6 against a target running NX-OS 9.3.6.
cc @praveenramoorthy
@feisa seems you are using user module on MDS switch. One of the show commands used by this module was not giving a valid json output and hence the issue. This is specific to MDS switches only. I had raised a bug for this against MDS and the issue is already fixed. The fix will be part of the future MDS software releases.
@feisa Hello. The nxos_snmp_user
module has been identified to have "Limited support for Cisco MDS" and hence, it might not function fully as expected with MDS right now.
cc @srbharadwaj for further info and timeline on this. Thanks!
@feisa seems you are using user module on MDS switch. One of the show commands used by this module was not giving a valid json output and hence the issue. This is specific to MDS switches only. I had raised a bug for this against MDS and the issue is already fixed. The fix will be part of the future MDS software releases.
Praveen, can you email me the bug id which is raised against MDS nxos, does the playbook work with the fixed image?
According to the above update, this is fixed. Can you please point me to the collection with fixed module?
@rozmusjs according to Praveen, the fix is in NXOS not in the module per se, so please try the same module on an MDS switch running 9.2(1)
thanks for the note. We're upgrading a pair of MDS switches this weekend. We'll report back after the upgrade is completed.
@rozmusjs Please share an update on the same, also note that nxos_snmp_user is now replaced with a new module
@feisa @rozmusjs Since we haven't heard from you yet, we're closing this issue for now. Please feel free to re-open this or create a new one when you have more updates for us. Thank you.