如何使用Ansible输入私钥密码 [英] How to enter private key password with ansible

查看:681
本文介绍了如何使用Ansible输入私钥密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行无业游民的virtual machine.

I have the vagrant virtual machine running.

我可以使用ssh vagrant@192.168.0.28进入ssh,然后它询问我私钥的密码,我可以输入该密码然后登录.

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.

但是如果我使用:

ansible all -m ping

然后我得到了:

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

我如何在ansible中输入密码?

How can I enter pass phrase in ansible?

我尝试了ansible -k,但是它说验证失败.

I tried ansible -k but it says authentication failed.

推荐答案

尝试使用ssh作为传输方式.通常,Ansible使用paramiko,它对交互式会话不太友好:

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

ansible all -c ssh -m ping

如果这行不通,在文档或代码中运行带有ssh密钥密码的Ansible时,我看不到任何东西,因此您可能需要使用以下内容将其删除:

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

这篇关于如何使用Ansible输入私钥密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆