I am facing this annoying bug: Ansible hosts are randomly unreachable #18188 .
Is there a way to tell Ansible that if SSH connection fails, to try it once more? Or 2 times more?
According this post New SSH Retry In Ansible 2.0? there is "retries" option but it doesn't seem very trustworthy to me, the person who posted didn't even get SSH header right and there is no mention of this in Ansible docs.
retry file. When playbooks fail to run against a host Ansible creates a retry file name 'hostname. retry. ' The file outlines the problem Ansible had running the play.
By default, Ansible ships with several connection plugins. The most commonly used are the paramiko SSH, native ssh (just called ssh), and local connection types. All of these can be used in playbooks and with /usr/bin/ansible to decide how you want to talk to remote machines.
Ansible can use a variety of connection methods beyond SSH. You can select any connection plugin, including managing things locally and managing chroot, lxc, and jail containers.
Yes, it is possible using the method which you referenced in your question, i.e. by placing the following parameter in ansible.cfg
:
[ssh_connection]
retries=2
retries
from ansible.cfg
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With