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

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

问题描述

我正在运行无业游民虚拟机.

我可以使用 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天全站免登陆