- name: Set delaybeforesend using pexpect
hosts: your_target_host
tasks:
- name: Run the command with pexpect and set delaybeforesend
shell: |
python -c "
import pexpect
child = pexpect.spawn('your_command_here')
child.delaybeforesend = 0.5 # Set the desired delay
child.expect('expected_prompt')
child.sendline('response')"
On Thursday, December 1, 2022 at 6:58:34 PM UTC-8 phillip.from.oz wrote:
> Hi,
> I undestand that 'Ansible Expect' uses python pexpect.
>
> Do you know if ansible playbook can change pexpect's 'delaybeforesend'?
>
> ' delaybeforesend' is used to wait a little time before sending a response
> to a prompt.
> The reason for this sometimes my Ansible Expect playbook works and
> sometimes the same playbook fails. I think this is a timing issue when the
> program on the remote side is a bit slow.
>
>
>
--
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/534a45e7-3822-4986-8cb3-e202208ea165n%40googlegroups.com.