`ERROR! Specified inventory, inventory directory, or script does not exist` / `[WARNING]: provided hosts list is empty, only localhost is available`
BeginnerTroubleshootingConnection and SSH Failures
Answer
Likely causes → Wrong -i path, wrong working directory, or inventory = missing from ansible.cfg; a trailing comma is needed for a one-off host list.
Diagnose →
ansible --version | grep 'config file'
ansible-inventory -i inventory.ini --graph
Fix → Fix the path, or use -i 'web01,' (with the comma) for a single host.
Prevent → Set inventory in a checked-in ansible.cfg.
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 10.0.1.15 port 22: Connection timed out"}`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