17

I'm using ansible in the following way:

ansible-playbook -f 1 my-play-book.yaml --ask-pass --ask-sudo-pass

After this I'm asked to enter the ssh & sudo passwords (same password for both).

Inside my playbook file I'm using synchronize task:

synchronize: mode=push src=rel/path/myfolder/ dest=/abs/path/myfolder/

For each host, I'm prompted to enter the ssh password of the remote host (the same that I entered in the beginning of the playbook run)

How can I avoid entering the password when executing synchronize task?

gilad hoch
  • 2,846
  • 2
  • 33
  • 57
Mizh
  • 361
  • 2
  • 11
  • 1
    Can you setup ssh keys to use instead or are passwords a requirement? – Mxx Jul 02 '14 at 05:14
  • 1
    I tried to setup the keys and i'm able to ssh manually without entering a password. But when I try it via ansible i'm asked to enter a password. – Mizh Jul 03 '14 at 07:17
  • 1
    Even if you remove `--ask-pass` parameter? – Mxx Jul 03 '14 at 12:35

1 Answers1

1

If you have setup the ssh keys correctly on the <host>, then the following should work.

ansible all -m synchronize -a "mode=push src=rel/path/myfolder/ dest=/abs/path/myfolder/" -i <host>, -vvv

I was able to get the above working without any password prompt.

zakuni
  • 51
  • 12
akh
  • 101
  • 2
  • 5