Fix Ansible "UNREACHABLE" Error: Host Connection Troubleshooting
By Luca Berton · Published 2024-01-01 · Category: installation
How to fix Ansible UNREACHABLE error. Troubleshoot SSH connectivity, timeout, wrong port, firewall issues. Complete diagnosis and fix guide.
Fix Ansible "UNREACHABLE" Error: Host Connection Troubleshooting
The UNREACHABLE! error means Ansible cannot connect to a host via SSH. Here's how to diagnose and fix it.
Common Causes and Fixes
1. Wrong SSH Credentials
2. SSH Port is Not 22
3. Host Key Verification Failed
4. Firewall Blocking SSH
5. DNS Resolution Failure
6. SSH Timeout
Debugging Steps
FAQ
What does UNREACHABLE mean in Ansible?
UNREACHABLE means Ansible's SSH connection to the host failed. The host may be down, the SSH port may be blocked, credentials may be wrong, or a network issue prevents connectivity.
How do I fix UNREACHABLE errors? Verify the host is up: ping hostname Test SSH manually: ssh user@hostname Check inventory settings (host, port, user, key) Increase timeout in ansible.cfg Run with -vvvv for detailed error output
How do I skip unreachable hosts?
Use --forks 1 to process sequentially, or set ignore_unreachable: true on tasks that should continue despite unreachable hosts.
Related Articles • Install Ansible: Complete Guide • Ansible Configuration Guide
Category: installation