Ask for a new password for every host using --ask-pass

Hello,

i need to add my ssh key first to be able to connect using it.

I made a simple playbook for it:

  • hosts: all
    tasks:
  • name: add admin ssh keys
    authorized_key: user=root key={{ ssh_key[item] }} state=present
    with_items:
  • user1
  • user2
  • user3

I’m only asked once for a password, but all servershave different passwords.

Why don’t asks Ansible for a password every time the login via key don’t works?

Hi,

That’s exactly what I’m looking for.
I was trying to find a way to automatically configure my hosts for ansible with one playbook by create a new user, add the ssh keys etc… but my servers don’t have the same password, so i’m trying to find a way where ansible ask the password for each host.
So far i’m like you, it asks the password only at the begining and apply that password for all of the hosts.

Have you found a way to do what you were looking for?

Thanks

Pierre