cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1032
Views
0
Helpful
2
Replies

Issue with Ansible playbook in CIMC

palashbarua
Level 1
Level 1

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?

2 Replies 2

Marcel Zehnder
Spotlight
Spotlight

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

 

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