Ansible - Random SSH Connection Timeout

I had a random SSH Connection Timeout with a playbook on a CentOS7 server in GCP.

A thread on similar problem exist in the ansible issue 17349.

I have tried to change sshd_config with MaxStartups and MaxSessions with no luck.

For me the solution was to add a “retries” in the “ssh_connection” section of the ansible config file.

retries = 10

I can still see the connection timeout with “-vvv” but ansible do a “ssh_retry” and the playbook continue.

Discuss on Twitter