On 01.08.2019 00:24, Kenneth Wong wrote:
Thanks Kai  for your response.
Just for clarification. Can Ansible support the following scenario?
1. Ansible ssh into a remote system using username/password.
2. Ansible waits for a specific prompt from the remote side.
3. Ansible than sends the command.
4. Ansible wait for the command response and return the output to the
caller.
I have a simple Python script using the Paramiko library to perform the
above operations.
But I am hoping I can use Ansible directly for this to interact with number
of remote servers.
I looked at the Ansible expect module example and seems like it first sends
the command and than look for some response and sends the corresponding
response.
I also saw the cli_command and that seems to have the interaction I needed
but it seemed to be only for network devices.

The expect module is perfect for this.

Instead of letting Ansible do ssh you, you set the task to "delegate_to: localhost" and let expect do ssh as the command.

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

Reply via email to