`UNREACHABLE! => {"msg": "Failed to connect to the host via ssh: ssh: connect to host 10.0.1.15 port 22: Connection timed out"}`
BeginnerTroubleshootingConnection and SSH Failures
Answer
Likely causes → Security group or firewall blocking port 22, host down, wrong IP, or no route (private subnet without bastion).
Diagnose →
nc -vz 10.0.1.15 22
traceroute -T -p 22 10.0.1.15
ansible-inventory --host web01 | grep ansible_host
Fix → Open TCP 22 from the controller or bastion, correct ansible_host, or add ansible_ssh_common_args: '-o ProxyJump=bastion'.
Prevent → Keep network access for the control node in IaC, and use dynamic inventory with private IPs.
More on Connection and SSH Failures
`UNREACHABLE! => {"msg": "Failed to connect to the host via ssh: Permission denied (publickey,password)."}`Beginner`UNREACHABLE! => {"msg": "Failed to connect to the host via ssh: ssh: connect to host web01 port 22: Connection refused"}`Beginner`Host key verification failed.` after rebuilding a serverBeginnerThe playbook hangs for ever at "Gathering Facts" on one hostIntermediate`Failed to connect to the host via ssh: Too many authentication failures`Intermediate`fatal: [web01]: UNREACHABLE! => {"msg": "Failed to connect to the host via ssh: Shared connection to web01 closed."}` mid-runIntermediate