无法使用Ansing ping RHEL主机。错误:“权限被拒绝(公钥,gssapi-keyex,gssapi-with-mic,密码)

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

我是Ansible的新手。我正在尝试使用ansping从主机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命令:

可全部使用-vvv -m ping -iventure.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
}
linux ssh ansible virtualbox redhat
1个回答
0
投票

该错误消息只是SSH错误消息。由于您正在指定ansible_useransible_ssh_password,因此您可能想确认指定的用户(target_user)可以使用target_pass登录。

也有可能目标机器不允许target_user使用密码登录。

很难从此错误消息中更具体地说明。尝试使用“ -vvv”运行您的Ansible命令,并使用此附加文本更新问题。

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