Ansible prompts password when using synchronize
Asked Answered
S

1

18

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?

Scotia answered 1/7, 2014 at 7:13 Comment(3)
Can you setup ssh keys to use instead or are passwords a requirement?Desultory
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.Scotia
Even if you remove --ask-pass parameter?Desultory
H
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.

Hysterical answered 14/4, 2015 at 4:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.