Reputation: 51
I need to make the script prompt for enable password after entering in unprivileged mode in cisco ios. So far this is what I have which works but I don't want to put my real "enable" password on anywhere on my computer.
---
- name: Basic Show Commands
hosts: cisco
gather_facts: False
connection: local
tasks:
- name: show run
ios_command:
commands:
- show run
provider:
authorize: yes
auth_pass: my_enable_password
register: show_run
- debug:
var: show_run.stdout_lines
- name: copy show run to file
local_action: copy content={{show_run.stdout[0]}} dest=/mnt/c/Ansible/show_run
I run the playbook as follows:
ansible-playbook -u my_username -k /mnt/c/Ansible/show_run.yaml
How do I make this happen?
Upvotes: 1
Views: 3650
Reputation: 11
This is very old thread, but for the sake of someone new searching for the answer, I did this-
ansible-playbook -u my_username --ask-pass --ask-become-pass /mnt/c/Ansible/show_run.yaml
Also, in the host file,
[host_group:vars]
ansible_become=yes
ansible_become_method=enable
ansible_network_os=ios
Upvotes: 1
Reputation: 68344
An option "to make the script prompt for enable password" would be to use vars_prompt. See the example below
...
vars_prompt:
- name: "my_enable_password"
prompt: "Cisco auth_pass:"
tasks:
...
Upvotes: 0