相关疑难解决方法(0)

Ansible 无法与 SSH 连接(横幅交换)

如果问题不清楚和/或如果我没有问我应该在哪里,请提前抱歉。

我在通过 SSH 连接到带有 ansible 的主机时遇到问题。几天前它起作用了,但几天来我一直有相同的消息错误:

        camille@ubuntu:~$ ansible all  -m ping -u remote
192.xxx.xxx.xxx | UNREACHABLE! => {
        "changed": false, 
        "msg": "Failed to connect to the host via ssh: Connection timed out during banner exchange\r\n", 
        "unreachable": true
    }
Run Code Online (Sandbox Code Playgroud)

SSH 连接(没有ansible)运行良好,所以我不太明白这个问题。我在 Ubuntu 16.04 VM 上运行 Ansible,我想访问的主机是 CentOS 7 VM。

我的主机文件如下:

[test]    
192.xxx.xxx.xxx ansible_ssh_user=remote ansible_ssh_pass=password ansible_sudo_pass='password' #VM CentOS
Run Code Online (Sandbox Code Playgroud)

我尝试了此处解释的解决方案但没有解决问题。

编辑 1:在尝试 Ripper Tops 解决方案并测试其他一些东西后,我的库存现在看起来像这样:

[test]
192.xxx.xxx.xxx ansible_connection=ssh ansible_user=remote ansible_password='password'

[test:vars]
proxy=my_proxy:8080
Run Code Online (Sandbox Code Playgroud)

我也尝试将超时增加到 25,但我仍然遇到同样的问题。

编辑2

更改我的 ansible.cfg …

ssh ansible

6
推荐指数
2
解决办法
2万
查看次数

运行 Ansible playbook 时出现 UNREACHABLE 错误

我确实可以访问目标计算机的 ssh,并且它可以工作,但是每当我运行此剧本时,我都会收到以下错误输出:

sudo ansible-playbook ansible-playbook-test.yml

PLAY [openstack] *****************************************************************************************************************************************************************************************

TASK [Gathering Facts] ***********************************************************************************************************************************************************************************
fatal: [amachine]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password,keyboard-interactive).\r\n", "unreachable": true}
        to retry, use: --limit @/blah/ansible-play/ansible-playbook-test.retry

PLAY RECAP ***********************************************************************************************************************************************************************************************
amachine       : ok=0    changed=0    unreachable=1    failed=0
Run Code Online (Sandbox Code Playgroud)

我的剧本就是这样简单:

---
# hosts could have been "remote" or "all" as well

- hosts: openstack
  tasks:
    - name: test connection
      ping:
      remote_user: djuarezg
      vars:
        ansible_ssh_extra_args: '-K -o ControlPath=none'



- hosts: openstack
  tasks:
    - name: …
Run Code Online (Sandbox Code Playgroud)

ansible

5
推荐指数
2
解决办法
1万
查看次数

标签 统计

ansible ×2

ssh ×1