so this actual error encountered is not an SSH error with return code of 255?
As told by @bcoca, there are other error codes returned by your ssh client on some failed events. IIRC, you can see it in verbose mode (-v) with enough âvâ; I think you need 3 to print connection info. Error code should be in there.
Assuming youâre using bash and have a close enough ssh client config from your Ansible one, you could also get it from a command like: ssh <yourHost> <yourParameters> 2>/dev/null; echo $?
what can I do to make sure this scenario also got SSH retries?
Now Iâm not sure or I donât remember how to deal with unreachable hosts; on sure thing is that you canât use block/rescue, nor failed_when. Perhaps using a callback plugin to issue n retries on failed connections that returns codes other than 255.
You can use meta: clear_host_errors to reactivate all hosts, so subsequent tasks can try to reach them again.
So perhaps a looping ansible.builtin.ping task or whatever, with a subsequent meta: clear_host_errors until it works, though again, I donât see a way to register unreachable hosts.
Or a script youâd run locally as pre-task that try to reach your inventory hosts through ssh and output return codes you could parse to identify unreachable hosts before Ansible does, and deal with them the way you want ?
Just some thoughts; there might be an easier solution.
Thatâs not âunreachableâ in the ssh sense. Ssh reached, and the remote rejected your key. Itâs unreachable in the ansible sense, in that ansible shouldnât expect any better results in the next 9 attempts.