An Ansible playbook fails with "UNREACHABLE! ... Permission denied (publickey)". Fix it.
BeginnerHands-onLive debugging tasks
Answer
ansible web1 -i inventory.yml -m ping -vvvv # shows the exact ssh command used
ssh -i ~/.ssh/prod.pem [email protected] # reproduce manually
chmod 600 ~/.ssh/prod.pem
Check ansible_user (ubuntu vs ec2-user vs admin), ansible_ssh_private_key_file, and that the key is in the target user's authorized_keys.
Key trick → -vvvv prints the full SSH command Ansible runs, which you can paste into a terminal to reproduce. Wrong username is the cause most of the time.
More on Live debugging tasks
A pod is in CrashLoopBackOff. You have 10 minutes. Walk through your commands.BeginnerThe pod shows `OOMKilled`. Diagnose and fix it.BeginnerA pod is stuck in `ImagePullBackOff`. Fix it.BeginnerA pod is `Pending` forever. What do you check?AdvancedThe Service returns "connection refused" but pods are Running. Debug it.IntermediateA Docker container exits immediately after `docker run -d`. Find out why.Beginner