我正在尝试使用Ansible来设置主机,这些主机最初只能通过SSH使用密码(不是密钥文件)访问(是的,我的第一本游戏是设置基于密钥的访问)。
我可以从命令行使用SSH密码访问主机。
在详细模式下运行Ansible提供以下输出
EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="debian"' -o ConnectTimeout=30 -o ControlPath=/home/home/.ansible/cp/2d22e058dc 192.168.122.11 '/bin/sh -c '"'"'echo ~debian && sleep 0'"'"''
<192.168.122.11> (255, b'', b'OpenSSH_8.9p1 Ubuntu-3, OpenSSL 3.0.2 15 Mar 2022
debug1: Reading configuration data /home/home/.ssh/config
...
debug3: no such identity: /home/home/.ssh/id_dsa: No such file or directory
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
debian@192.168.122.11: Permission denied (publickey,password).看起来,SSH客户端被迫不使用密码PasswordAuthentication=no,而输出的其余部分中没有任何显示它正在尝试的东西。
这是我的主机文件(不,它们不是真正的密码)
all:
children:
init:
hosts:
bullseye-apps:
bullseye-backup:
vars:
ansible_ssh_pass: 'password'
ansible_become_pass: 'password'所以我想我应该让Ansible选择使用密码。
我按以下方式运行我的剧本
ansible-playbook -i test-hosts.yml playbook.yml我最近升级了我的操作系统(升级到Pop_OS!22.04),并且已经有一段时间没有运行这些游戏了,所以可能是Ansible中的一个变化吗?
$ ansible --version
ansible 2.10.8
config file = /home/home/Projects/federated-agency/ansible.cfg
configured module search path = ['/home/home/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 3.10.4 (main, Apr 2 2022, 09:04:19) [GCC 11.2.0]有什么想法吗?
发布于 2022-06-07 02:57:17
看来我拼错了其中一个主机的用户名,该死!
https://stackoverflow.com/questions/72524252
复制相似问题