cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2050
Views
1
Helpful
2
Replies

Update password with ios_user module

palashbarua
Level 1
Level 1

I am trying to change Cisco controller password with ansible cisco.ios.ios_user module. My playbook as below:

- name: Playbook to change admin user password for CIMC
  hosts: cimcserver
  gather_facts: no
  become: yes
  become_method: enable
 
  tasks:
    - name: CIMC new user details
      cisco.ios.ios_user:
        name: admin
        configured_password: <new_password>
        update_password: always
        state: present

But I am getting error as below:
fatal: [xxxxxxx-cimc]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"}, "changed": false, "msg": "unable to elevate privilege to enable mode, at prompt [\nC220-XXXXX# ] with error: failed to elevate privilege to enable mode still at prompt [\nC220-XXXXXX# ]"}
 
Need help to solve the issue, thanks.
2 Replies 2

Alexander Stevenson
Cisco Employee
Cisco Employee

Hi @palashbarua,

Can you please try running the playbook in verbose mode "-vvvv" and paste the result here?

 

 

The issue here is that your task is trying to run the commands in enable mode but it is unable to elevate privileges to do so. Something like.... might work.

 

- name: Playbook to change admin user password for CIMC
  hosts: cimcserver
  gather_facts: no
  become: yes
  become_method: enable
  vars:
    ansible_become_pass: <enable_password>
 
  tasks:
    - name: CIMC new user details
      cisco.ios.ios_user:
        name: admin
        configured_password: <new_password>
        update_password: always
        state: present

 

 

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io