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. new code:




- 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/22f7e596-518b-4e5b-810a-92d103485391%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to