I wrote an ansible script that collects inventory details and then filters the switches by serial number. After that, I will use the cisco.dcnm.dcnm_inventory modules to update the switch password from Cisco NDFC. I do not want to pass the current switch password because it is already configured in NDFC and can connect without it.
playbook:
Unfortunately, we don’t seem to have a @cisco working group, but we do have @network-wg. Hopefully someone can give you better tips than I can. All I can say is that your config parameter is invalid. Your keys are in the wrong place, misspelled, or invalid altogether.
The following is doctored up based on Ansible Galaxy - cisco.dcnm documentation, but I don’t have any experience with Cisco here to know exactly what’s going on or what else you may need. I’m not sure if you can just change the password here and it propagates changes to the switches, or if you need to change the password some other way but update the inventory here to match. Whatever the case, the seed_ip, user_name, and password are required by this module.
- name: Update switch credentials in NDFC inventory
cisco.dcnm.dcnm_inventory:
fabric: "{{ fabric_name }}"
state: merged
config:
- seed_ip: "{{ seed_ip }}" # required
user_name: "{{ new_switch_username }}" # required
password: "{{ new_switch_password }}" # required
# you can only specify serial number in the poap/rma boostrapping sections
# poap:
# - serial_number: "{{ switch_serial }}"
# rma:
# - serial_number: "{{ switch_serial }}"