Handling Prompt in Cisco IOS_CONFIG module

446 views
Skip to first unread message

R.B. Kumar

unread,
May 30, 2021, 4:45:09 PM5/30/21
to Ansible Project
Hello All -  Using Ansible v2.7  
I am tying to execute Cisco IOS commands that prompts to type Y/N.  Looks like the Prompt: is not available in ios_config module. For example

- name: delete_crypto_map
   ios_config:
   lines:
     - no crypto pki trustpoint CTA
     - yes
The above script doesnt work as the logs shows connection error: timeout value 10 seconds reached while trying to send command
Looks like the after executing the command  no crypto pki trustpoint CTA the Y/N is prompted by the ansible is not sending Y to the prompt

The prompt: works for ios_commands: module but doesnt work on ios_config: 

Do you have any experience on this kind of requirement or thoughts please?



R.B. Kumar

unread,
May 31, 2021, 6:10:07 AM5/31/21
to Ansible Project
Can anybody have requirement similar to this? I tried with cli_command, ios_command too.. 

R.B. Kumar

unread,
May 31, 2021, 7:25:21 AM5/31/21
to Ansible Project
I got the answer from another forum. It is just a workaround only using cli_command module

I read ansible 2.7 dont support prompt in ios_config. 
We need to user ios_command with loop as below

- name: delete_crypto_map
   cli_command:
   command: "{{ item }}"
    prompt:
        - "Are you sure you want to do this"
    answer: 'yes'
    loop:
     - config t     
     -  no crypto pki trustpoint CTA

Rajthecomputerguy

unread,
May 31, 2021, 10:59:14 AM5/31/21
to ansible...@googlegroups.com
Yes, ios_config does not support prompting, Can you disable prompting and re-enable once a task is done?

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/30ad8d60-c2e1-43b4-98a6-22b866f8907an%40googlegroups.com.


--

Thanks,

Pushparaj G


Reply all
Reply to author
Forward
0 new messages