Increase timeout of SSH command in Ansible


I am currently using Ansible to provision bare metal using an IPv6 link local address. Once the servers are provisioned, ansible will run a series of tests on the server, as one shell command, to ensure provisioning was successful. These tests take approximately 10 minutes to run.

The issue that I’m facing is that the connection seems to timeout before the command completes.

Here is the error from Ansible:

By looking at this error, one might think there is an issue with the SSH connection. The SSH connection itself is good since several other tasks run successfully on the same host prior to this task.

How can I increase the timeout so that Ansible will wait for the command to finish? Can this timeout be increased within the Ansible configuration, or do I need to modify the command itself to increase the timeout?


You’re going to want to run the task asynchronously. High-level steps would be:

  1. send deployment request for instance
  2. get some kind of instance or request id for said request
  3. poll for result of request
  4. continue playbook

here’s an example of this behaviour from the official docs

Leave a Reply