Ansible 在尝试 -m ping all 时出现“无法通过 ssh 连接到主机:权限被拒绝”

问题描述 投票:0回答:1

我整个早上都在处理这个问题,并且在其他地方看到了多个关于此错误的帖子,但目前似乎没有一个解决方案对我有用。

我正在使用 Ansible 并尝试为该项目设置我的库存+主机。

对于我的主机文件,我有(/etc/ansible/hosts):

[test-servers]

x.x.x.x

对于我的库存,我有(/etc/ansible/inventory.txt):

ansible-target ansible_ssh_host=x.x.x.x ansible_user=user ansible_ssh_pass=password

但是当我尝试运行

ansible -m ping all
时,我得到:

x.x.x.x | UNREACHABLE! => {
"changed": false,
"msg": Failed to connect to the host via ssh: [email protected]: Permission denied (publickey,password,keyboard-interacgive.\r\n"
"unreachable":true
}

但是,当我运行时,我成功得到了 pong 响应:

ansible x.x.x.x -m ping -i /etc/ansible/inventory.txt

有人知道这可能是什么吗?

提前致谢。

ansible ansible-inventory
1个回答
0
投票

找到解决方案。需要它提示我输入密码来设置初始 Ansible SSH 配置。

Ansible:权限被拒绝(公钥、密码)

© www.soinside.com 2019 - 2024. All rights reserved.