# How to use enable password with ansible

**URL:** <https://forum.ansible.com/t/how-to-use-enable-password-with-ansible/30713>\
**Category:** Ansible Project\
**Created:** [July 4, 2019, 3:57am UTC](https://forum.ansible.com/t/how-to-use-enable-password-with-ansible/30713 "2019-07-04T03:57:15Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ankur\_Atri](https://avatars.discourse-cdn.com/v4/letter/a/a9a28c/32.png) [@Ankur\_Atri](https://forum.ansible.com/u/Ankur_Atri)\
**Post date:** [July 4, 2019, 3:57am UTC](https://forum.ansible.com/t/how-to-use-enable-password-with-ansible/30713/1 "2019-07-04T03:57:15Z")

</div>

I am trying to perform telnet which works fine with username & password but i want to find a way to enter enable password. Below example does not work.

- name: run show commands  
hosts: routers  
gather\_facts: False  
tasks:

- telnet:  
password: cisco  
prompts:

- “[\>|#]”  
command:

- enable

- “password”

- show version

---

<div class="post-metadata">

**Author:** ![Ankur\_Atri](https://avatars.discourse-cdn.com/v4/letter/a/a9a28c/32.png) [@Ankur\_Atri](https://forum.ansible.com/u/Ankur_Atri)\
**Post date:** [July 4, 2019, 5:50am UTC](https://forum.ansible.com/t/how-to-use-enable-password-with-ansible/30713/2 "2019-07-04T05:50:54Z")

</div>

I was able to make it work but now after successful execution, it does not make changes on the end device but result says changes are done.

root@NetworkAutomation-2:~# cat telnettest.yml

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [July 4, 2019, 5:59am UTC](https://forum.ansible.com/t/how-to-use-enable-password-with-ansible/30713/3 "2019-07-04T05:59:18Z")

</div>

Ansible offers dedicated functionality to deal with enable mode on IOS:

[https://docs.ansible.com/ansible/latest/network/user\_guide/platform\_ios.html](https://docs.ansible.com/ansible/latest/network/user_guide/platform_ios.html)

---

<div class="post-metadata">

**Author:** ![Ankur\_Atri](https://avatars.discourse-cdn.com/v4/letter/a/a9a28c/32.png) [@Ankur\_Atri](https://forum.ansible.com/u/Ankur_Atri)\
**Post date:** [July 4, 2019, 6:12am UTC](https://forum.ansible.com/t/how-to-use-enable-password-with-ansible/30713/4 "2019-07-04T06:12:12Z")

</div>

Thank you for the response but i am working on TELNET not SSH.

I am able to telnet the router but changes are not taking effect.

---

<div class="post-metadata">

**Author:** ![Ankur\_Atri](https://avatars.discourse-cdn.com/v4/letter/a/a9a28c/32.png) [@Ankur\_Atri](https://forum.ansible.com/u/Ankur_Atri)\
**Post date:** [July 5, 2019, 4:37am UTC](https://forum.ansible.com/t/how-to-use-enable-password-with-ansible/30713/5 "2019-07-05T04:37:34Z")

</div>

can any expert guide here?

---

<div class="post-metadata">

**Author:** ![Chiu\_Hsia\_Peng](https://avatars.discourse-cdn.com/v4/letter/c/e0b2c6/32.png) [@Chiu\_Hsia\_Peng](https://forum.ansible.com/u/Chiu_Hsia_Peng)\
**Post date:** [July 5, 2019, 7:48am UTC](https://forum.ansible.com/t/how-to-use-enable-password-with-ansible/30713/6 "2019-07-05T07:48:17Z")

</div>

Hi,  
Because I have no cisco device on handy, I “guess” this may work!  
Add “Password:” (after “enable” command) as a valid prompt.

prompts:

- “[\>|#] |Password:”

Reference page:[https://qiita.com/Yohichi\_Hayashi/items/772ea6b1e66d4cc8aa26](https://qiita.com/Yohichi_Hayashi/items/772ea6b1e66d4cc8aa26)`

sincerely,  
Jane#

Ankur Atri於 2019年7月5日星期五 UTC+8下午12時37分34秒寫道：

---

<div class="post-metadata">

**Author:** ![Chris\_Chapman](https://avatars.discourse-cdn.com/v4/letter/c/d26b3c/32.png) [@Chris\_Chapman](https://forum.ansible.com/u/Chris_Chapman)\
**Post date:** [November 6, 2019, 8:01am UTC](https://forum.ansible.com/t/how-to-use-enable-password-with-ansible/30713/7 "2019-11-06T08:01:04Z")

</div>

Hi Ankur,

I had the same problem with some old hardware, and found, after studying the code [1](https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/action/telnet.py), that the following solution works:

- name: run show commands  
hosts: routers  
gather\_facts: false

connection: local

tasks:

- telnet:  
login\_prompt: "Password: "  
user: “{{ password }}”

prompts:

- “[\>#]”  
command:

- “enable\n{{ enable\_password }}”

- terminal length 0

- show running-config

Cheers,

Chris Chapman
