On Thursday, 16 November 2017 15.00.29 CET [email protected] 
wrote:
>  installed pexpect also on remote machine and nowit is working.
> 
> Now the code you suggested provides this output:
> 
> fatal: [stefano2]: FAILED! => {
>     "changed": true,
>     "cmd": "telnet 0.0.0.0 2200",
>     "delta": "0:00:26.267272",
>     "end": "2017-11-16 14:57:39.806298",
>     "failed": true,
>     "invocation": {
>         "module_args": {
>             "chdir": null,
>             "command": "telnet 0.0.0.0 2200",
>             "creates": null,
>             "echo": false,
>             "removes": null,
>             "responses": {
>                 "Press any key to continue\\.": "",
>                 "login": "username",
>                 "password": "password"
>             },
>             "timeout": 30
>         }
>     },
>     "msg": "non-zero return code",
>     "rc": 1,
>     "start": "2017-11-16 14:57:13.539026",
>     "stdout": "Trying 0.0.0.0...\r\r\nConnected to 0.0.0.0.\r\r\nEscape 
> character is '^]'.\r\r\nstefano2.prv\r\nUnauthorized access 
> prohibited.\r\nlogin: username\r\nPassword: Connection closed by foreign 
> host.",
>     "stdout_lines": [
>         "Trying 0.0.0.0...",
>         "",
>         "Connected to 0.0.0.0.",
>         "",
>         "Escape character is '^]'.",
>         "",
>         "stefano2.prv",
>         "Unauthorized access prohibited.",
>         "login: username",
>         "Password: Connection closed by foreign host."

In you previous mail you wrote password:, but it's actually Password with a 
capital P.

Default the expect responses is case sensitive, so you need to change it to 
  Password: password
or make it case insensitive like so
  (?i)password: password


-- 
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/3710296.O7CBbsIC2B%40x1.
For more options, visit https://groups.google.com/d/optout.

Reply via email to