Ansibleexit code > 0
UNREACHABLE!
$192.168.1.50 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: ssh: connect to host ... port 22: Connection refused",
"unreachable": true
}
Analysis
Ansible could not establish an SSH connection to the target host.
Common Triggers
- ●Host is down.
- ●SSH key issue.
- ●Firewall blocking connection.
Debug Checks
- $Try manual SSH:
ssh user@host.
Resolution
1
Fix SSH connectivity (keys, firewall).
2
Ensure python is installed on target (for some modes).
Metadata
- Tool
- Ansible
- Severity
- High
- Tags
- #ansible#iac#ssh