On Thursday, October 19, 2017 at 2:39:52 PM UTC-4, Zimidar Boy wrote:
>
> Hello Kai,
>                    Solved the issue but i have to add 5 exit i don't know 
> why. Do you think it has to do something with number of commands as i am 
> running 5 commands for 1st question.
>
>
>
>
> - name: crates sftp session to terastation
>     expect:
>        command: ssh user@host
>
>
>        responses:
>            (?i)root@: ['sftp user@host', 'mkdir /tmp/backups', 'mv lst*tar 
> /tmp/backups', 'cd /tmp/backups', 'rm -rf $(ls -1t /tmp/backups | tail -n 
> +3)', 'exit', 'exit', 'exit', 'exit',' exit']
>
>            (?i)Password: 213gfdshaa
>            (?i)sftp>: ['cd a/o/h', 'put lst*tar', 'exit']
>
>
>
> On Thursday, October 19, 2017 at 12:44:16 PM UTC-4, Kai Stian Olstad wrote:
>>
>> On 19. okt. 2017 17:02, Zimidar Boy wrote: 
>> > 
>> > Hello Kai, 
>> >                       As soon as i used your solution now i am getting 
>> this 
>> > error: 
>> > 
>> >    "msg": "No remaining responses for '(?i)sftp>', output was ': 
>> \r\nsftp>'" 
>> > 
>> Without the full verbose output it's difficult to say. 
>>
>> But some systems print out the prompt after exit and before the command 
>> terminates. 
>> This will trigger this message in Ansible. 
>> You could try adding a extra exit, if that doesn't help you can set 
>> ignore_errors: true or write a expect script and run that instead. 
>>
>>
>> -- 
>> 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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/321f5161-66f6-4bef-b5f5-5e1b387e6318%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to