On Tue, Feb 18, 2020 at 02:38:40AM -0800, Gerhard Van Der Wath wrote:
> HI Kai.
> 
> When running this command via Ansible I am getting the following:
> 
> fatal: [######]: FAILED! => {
>     "changed": false, 
>     "invocation": {
>         "module_args": {
>             "chdir": null, 
>             "command": "ssh admin@#########", 
>             "creates": null, 
>             "echo": false, 
>             "removes": null, 
>             "responses": {
>                 "#": [
>                     "show xcode load -detail", 
>                     "exit"
>                 ], 
>                 "(?i)password": "#######"
>             }, 
>             "timeout": 30
>         }
>     }, 
>     "msg": "No remaining responses for '#', output was 'Sess  Current  

As the message says, expect still get the # prompt but doesn't have any more
responses to type in.


> Maximum\r\n  ===  ===  =====  =======  =======\r\n   00   0     14    
>  3.33%   29.28%\r\n   00   1     17     2.97%   29.02%\r\n   01   0     -  
>      -        -\r\n   01   1     -       -        -\r\n   02   0     -      
>  -        -\r\n   02   1     -       -        -\r\n   03   0     -       -  
>       -\r\n   03   1     -       -        -\r\n   04   0     -       -      
>   -\r\n   04   1     -       -        -\r\n   05   0     -       -        
> -\r\n   05   1     -       -        -\r\n   06   0     -       -        
> -\r\n   06   1     -       -        -\r\n   07   0     -       -        
> -\r\n   07   1     -       -        -\r\n   08   0     -       -        
> -\r\n   08   1     -       -        -\r\n   09   0     -       -        
> -\r\n   09   1     -       -        -\r\n   10   0     -       -        
> -\r\n   10   1     -       -        -\r\n   11   0     -       -        
> -\r\n   11   1     -       -        -\r\nSBCHA1#'"

The last part "\r\nSBCHA1#" show that expect get the prompt again.

> The output of the command is as below:
> 
> HA1# show xcode load -detail
> 12:37:54
> Total Sessions:            334
>               ----- Load -----
>   TCM  DSP  #Sess  Current  Maximum

In the output you have a #. Since you have said to expect that "#" is the sting
to trigger a response it will type exit<ENTER> here, but since this is not the
prompt this causes issues.

The text expect should trigger on in responses has to be unique, an in you case
# is not. So you need to add more characters to it.
If the prompt always is "BCHA1#" you can use that instead of only "#"


-- 
Kai Stian Olstad

-- 
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/20200218160601.geskqbuvmww7l7ly%40olstad.com.

Reply via email to