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



On Monday, May 31, 2021 at 3:40:07 PM UTC+5:30 R.B. Kumar wrote:

> Can anybody have requirement similar to this? I tried with cli_command, 
> ios_command too.. 
>
> On Monday, May 31, 2021 at 2:15:09 AM UTC+5:30 R.B. Kumar wrote:
>
>> 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?
>>
>>
>>
>>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/30ad8d60-c2e1-43b4-98a6-22b866f8907an%40googlegroups.com.

Reply via email to