"module_stderr": "与 <IP> 的共享连接已关闭。 “连接到 Cisco 交换机时

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

大家好,我一直在尝试将我的 Ansible 控制节点连接到 Cisco 交换机。

我能够 ping/ssh,但是当涉及到 Ansible 时,它就失败了。

当我使用 ad-hoc 命令时,出现以下错误

ansible cisco_node -m ping
[WARNING]: sftp transfer mechanism failed on [11.11.11.203]. Use ANSIBLE_DEBUG=1 to see detailed information
[WARNING]: scp transfer mechanism failed on [11.11.11.203]. Use ANSIBLE_DEBUG=1 to see detailed information
cisco_node | FAILED! => {
    "changed": false,
    "module_stderr": "Shared connection to 11.11.11.203 closed.\r\n",
    "module_stdout": "\r\n",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 0
}
ansible version: core 2.15.4
which python:/usr/bin/python

我试图指出

/usr/bin/python3
它仍然遇到同样的错误。

感谢您的帮助和建议。预先感谢。

希望我可以使用

ansible-playbook
连接到我的 Cisco 交换机进行一些测试。

ansible ansible-2.x ansible-inventory
2个回答
0
投票

根据提供的信息,您似乎尝试与交换机建立 SSH 连接。此类设备可能不具备 Python 脚本的所有功能。

因为

ping
模块 – 尝试连接到主机,验证可用的 python 并在成功时返回 pong

  • 不是 ICMP ping,...只是一个简单的测试模块,需要在远程节点上使用 Python

  • 是一个“...测试模块,此模块在成功联系时总是返回 pong。它在剧本中没有意义,但从 /usr/bin/ansible 验证登录能力以及可用的能力很有用Python已配置完毕。

为了建立与您未进一步指定的思科交换机的连接,您可以首先阅读有关

类似问答


0
投票

我已将以下内容添加到我的 /etc/ansible/hosts 中:

ansible_connection=network_cli ansible_network_os=ios

它似乎已经开始工作了。

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