On 7/8/20 12:19 PM,
rites...@gmail.com wrote:
> Hi Stefano,
>
> Is it necessary to install Pexpect on remote machine as well?
>
> Thanks & Regards,
> Ritesh Gupta.
Yes, see the module documentation:
https://docs.ansible.com/ansible/latest/modules/expect_module.html
Regards
Racke
>
> On Thursday, 16 November 2017 19:30:29 UTC+5:30,
stefano...@nap-anywhere.com 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."*
> * ]*
> *}*
> * to retry, use: --limit @/etc/ansible/api_gateways/apigw.retry*
> *
> *
> I just changed the command telnet 0 2200 to *telnet 0.0.0.0 2200*
>
> On Wednesday, 15 November 2017 15:07:58 UTC+1,
stefano...@nap-anywhere.com wrote:
>
> HI
>
> I created an ansble role which install on the target hosts IBM api connect gateways software and enable the service.
> I would improve this role adding configuration steps.
>
> After the installation the APIC gateways need to be configured accessing to a dedicated command line interface,
> the first access is made of the following steps:
>
> $ telnet 0 2200 *//command to launch to access the CLI*
> Trying 0.0.0.0...
> Connected to 0.
> Escape character is '^]'.
> stefano2.prv
> Unauthorized access prohibited.
>
> login: user *//here i need to write the username*
> Password: ***** *// as well as the password*
>
> ****************************************************************
> ATTENTION: Use care when making your selections for operational
> modes. If you select an incorrect mode for your environment,
> the only way to change an operational mode is to reinitialize
> the appliance.
>
> Press any key to continue.
> ****************************************************************
>
> I'm stuck here, i tried to add these lines:
>
> *- name: Launch the CLI first time*
> * expect:*
> * command: telnet 0 2200*
> * responses:*
> * Question:*
> * login: "user"*
> * Password: "password"*
> * Press any key to continue.: /bin/bash -c "echo"*
> *
> *
> Every time i try to run the role i gt this error at the end:
>
> *TASK [Launch the CLI first time]
> *************************************************************************************************************************************************************************
> *fatal: [stefano3]: FAILED! => {"changed": false, "failed": true, "msg": "The pexpect python module is required"}*
> *fatal: [stefano2]: FAILED! => {"changed": false, "failed": true, "msg": "The pexpect python module is required"}*
> * to retry, use: --limit @/etc/ansible/api_gateways/apigw.retry*
>
> Could you help me?
> How can i answer to the "Press any key to continue"?
>
> Or maybe there are further errors i did not get in the previous steps.
>
>
> --
> 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
>
ansible-proje...@googlegroups.com <mailto:
ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/ansible-project/2889a856-b49b-48e9-8881-d2a016735cd5o%40googlegroups.com
> <
https://groups.google.com/d/msgid/ansible-project/2889a856-b49b-48e9-8881-d2a016735cd5o%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.