Interview Prep/Ansible/Connection and SSH Failures

`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.

All Ansible questions Roadmap: Ansible

More on Connection and SSH Failures