linux - ansible如何输入私钥密码

标签 linux ssh ansible

我正在运行 vagrant 虚拟机

我可以使用 ssh vagrant@192.168.0.28 ssh 进入它然后它问我私钥的密码短语,我可以输入它然后它记录我中。

但如果我使用:

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 中输入密码?

我尝试了 ansible -k 但它说身份验证失败。

最佳答案

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

ansible all -c ssh -m ping

如果这不起作用,我在文档或代码中没有看到任何关于使用 ssh key 密码短语运行 Ansible 的信息,因此您可能必须使用如下内容将其删除:

openssl rsa -in private_key_with_pass_phrase -out private_key_without_pass_phrase

关于linux - ansible如何输入私钥密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22229688/

相关文章:

linux - 如何 Hook 特定共享 ELF 库的函数?

linux - 如何对以减号开头且包含空格的文件执行 sh 脚本?

linux批量查找文件

ruby-on-rails - heroku rails - 所有命令都给出 "No account specified"

ssh - 在 Ansible 中,如何在没有 ssh 的情况下在本地运行我的 playbook?

Ansible 服务重启失败

python - 消息 : ConnectionError(ProtocolError ('Connection aborted.' , 错误 (2, 'No such file or directory' )),)

linux - 在 linux 3.10 内核上挂载 usbfs

最新 git 版本的 Git 权限被拒绝(公钥)

Ansible 显示错误 : "One or more undefined variables: ' item' is undefined"when using 'with_items'