[英]Git Permission denied (publickey,gssapi-keyex,gssapi-with-mic)?
[英]Cannot ping RHEL hosts using ansible. Error: 'Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password)
我是 Ansible 的新手。 我正在尝试使用 ansible 从我的主机 ping 2 个 RHEL 目标。 我有一个清单文件设置如下:
target1 ansible_host=192.168.43.142 ansible_user=target_user ansible_ssh_password=target_pass
target2 ansible_host=192.168.43.8 ansible_user=target_user ansible_ssh_password=target_pass
我正在使用的 Ansible 命令:
ansible all -vvv -m ping -i inventory.txt
下面是我收到的消息。 请注意,两台目标机器的常规 ssh 都可以正常工作
ansible 2.9.4
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /bin/ansible
python version = 2.7.5 (default, May 3 2017, 07:55:04) [GCC 4.8.5 20150623 (Red Hat 4.8.5-14)]
Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /home/target_user/ansible/test-project/inventory.txt as it did not pass its verify_file() method
script declined parsing /home/target_user/ansible/test-project/inventory.txt as it did not pass its verify_file() method
auto declined parsing /home/target_user/ansible/test-project/inventory.txt as it did not pass its verify_file() method
yaml declined parsing /home/target_user/ansible/test-project/inventory.txt as it did not pass its verify_file() method
Parsed /home/target_user/ansible/test-project/inventory.txt inventory source with ini plugin
META: ran handlers
<192.168.43.142> ESTABLISH SSH CONNECTION FOR USER: target_user
<192.168.43.142> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="target_user"' -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/79ae0eeb97 192.168.43.142 '/bin/sh -c '"'"'echo ~target_user && sleep 0'"'"''
<192.168.43.8> ESTABLISH SSH CONNECTION FOR USER: target_user
<192.168.43.8> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="target_user"' -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/d23adc63a3 192.168.43.8 '/bin/sh -c '"'"'echo ~target_user && sleep 0'"'"''
<192.168.43.142> (255, '', 'Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).\r\n')
target1 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).",
"unreachable": true
}
<192.168.43.8> (255, '', 'Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).\r\n')
target2 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).",
"unreachable": true
}
该错误消息只是一条 SSH 错误消息。 由于您正在指定ansible_user
和ansible_ssh_password
,您可能需要确认指定的用户 ( target_user
) 可以使用target_pass
登录。
目标机器也有可能不让target_user
使用密码登录。
很难从此错误消息中更具体地说明。 尝试使用“-vvv”运行您的 Ansible 命令并使用此附加文本更新问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.