How to enter private key password with ansible

泪湿孤枕 提交于 2020-01-03 08:25:09

问题


I have the vagrant virtual machine running.

I can ssh into it using ssh vagrant@192.168.0.28 then it ask me the pass phrase for the private key , which I can enter and then it logs me in.

but if I use:

ansible all -m ping

then I get this:

192.168.0.28 | FAILED => FAILED: ssh moor@192.168.0.28:22 : Private key file is encrypted
To connect as a different user, use -u <username>.

How can I enter pass phrase in ansible?

I tried ansible -k but it says authentication failed.


回答1:


Try using ssh as the transport. Generally, Ansible uses paramiko which is not as friendly for interactive sessions:

ansible all -c ssh -m ping

If that doesn't work, I didn't see anything on running Ansible with an ssh key pass phrase on the documentation or in the code, so you might have to remove it with something like this:

openssl rsa -in private_key_with_pass_phrase -out private_key_without_pass_phrase


来源:https://stackoverflow.com/questions/22229688/how-to-enter-private-key-password-with-ansible

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