Ansible prompts password when using synchronize

匆匆过客 提交于 2019-12-23 06:55:07

问题


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?


回答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.



来源:https://stackoverflow.com/questions/24504430/ansible-prompts-password-when-using-synchronize

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!