02-10-2023 05:03 PM
I'm having issue with using Ansible playbook to run password setting commands. My playbook as below:
- name: Playbook to change admin user password for CIMC
hosts: cimcserver
gather_facts: no
tasks:
- name: multiple prompt, multiple answer (mandatory check for all prompts)
ansible.netcommon.cli_command:
command: '{{ item }}'
check_all: True
prompt:
- "Please enter password:"
- "Please confirm password:"
answer:
- "Just23+Pass\r"
- "Just23+Pass\r"
loop:
- scope user 1
- set enabled yes
- set password
- commit
- exit
But this not working, especially first command scope user 1.
I am trying to change password in all CIMC, What other options are there?
02-12-2023 05:25 AM - edited 02-12-2023 05:28 AM
Hi
Maybe it's easier to use a specialised module like https://docs.ansible.com/ansible/latest/collections/community/general/imc_rest_module.html
Payload for changing username/password is like
<configConfMo inHierarchical="false" dn="sys/user-ext/user-1">
<inConfig>
<aaaUser id="1" accountStatus="active" name="master.work" priv="admin"
pwd="password" dn="sys/user-ext/user-1"/>
</inConfig>
</configConfMo>
See https://www.cisco.com/c/en/us/td/docs/unified_computing/ucs/c/sw/api/3_0/b_Cisco_IMC_api_301/b_Cisco_IMC_api_301_appendix_01000.html for examples.
HTH
02-15-2023 11:32 PM
Hi Marcel Zehnder,
Thank you for providing this. Can I use module that is builtin, like cisco.aci, cisco.intersight, cisco.mso, cisco.nxos instead of imc? As I am not allowed to install new package in my system.
Again, thanks
Palash Barua
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide