-1

I'm trying to run an Ansible ad hoc command via SSH on a Ubuntu 14 LTS server:

ansible all -m ping -u myusername

However I get the following error message:

FAILED => SSH Error: Permission denied (publickey,password)

When I try to run the ad command with the flag for asking a password, it works:

ansible all -m ping -u myusername --ask-pass

absence.ugent.be | success >> {
"changed": false,
"ping": "pong"
}

Does anyone know why the command doesn't work without asking for my password? And how I can solve this?

update: as neuhaus suggested, I tried to remove the pass phrase from my ssh keyfile with:

ssh-keygen -p [-P old_passphrase] [-N new_passphrase] [-f keyfile]

But that didn't fix it. The odd thing is that I can still successfully run

ansible all -m ping -u myusername --ask-pass

with my old pass phrase, even after creating a new ssh key.

Thanks for your help,
Anthony

Toontje
  • 1,415
  • 4
  • 25
  • 43
  • Setup keybased auth for remote host. – Konstantin Suvorov Oct 11 '17 at 13:52
  • Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Super User](http://superuser.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. – jww Oct 12 '17 at 02:54

1 Answers1

-1

Your SSH key is protected by a passphrase. By adding --ask-pass, ansible will ask for this passphrase (not your login password).

If you want this to work without having to enter a password, remove the passphrase from your SSH key.

neuhaus
  • 3,886
  • 1
  • 10
  • 27