Interview Prep/Ansible/Cloud, AWX, Windows and Molecule

`ansible-navigator run site.yml` fails with `Permission denied (publickey)`, while `ansible-playbook site.yml` works

AdvancedTroubleshootingCloud, AWX, Windows and Molecule
Answer

Likely causes → Navigator runs the playbook inside an EE container. Your ~/.ssh keys are not visible there, and the SSH agent socket is only passed through if SSH_AUTH_SOCK is set and the agent holds the key. Custom key paths in inventory point at host paths that do not exist in the container.

Diagnose →

ssh-add -l
ansible-navigator run site.yml -m stdout -vvv 2>&1 | grep -i identity

Fix → Start the agent and add the key (eval "$(ssh-agent)"; ssh-add ~/.ssh/id_ed25519), or mount the key through the navigator settings:

ansible-navigator:
  execution-environment:
    volume-mounts:
      - src: ~/.ssh
        dest: /home/runner/.ssh
        options: ro

Use --ee false to confirm the problem is container-specific.

Prevent → Commit a project ansible-navigator.yml so every developer gets the same mounts and EE image.

All Ansible questions Roadmap: Ansible

More on Cloud, AWX, Windows and Molecule