默认的ansible模板返回错误 [英] default ansible template returns error

查看:208
本文介绍了默认的ansible模板返回错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认配置下的Ansible是否可与其他供应商一起使用?例如华为?

do Ansible in default configuration works with other vendors? For example Huawei ?

如果我正在运行一些测试命令,例如:

If i'm running some testing commands like:

sudo ansible -m shell-显示版本"服务器

sudo ansible -m shell -a 'display version' servers

10.46.1.1 | UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: \r\n**********************************************************************\r\n* Jus esate prisijunge prie privacios irangos. Visi veiksmai,vykdomi *\r\n* su sia iranga, yra fiksuojami. Tam, kad prieiti prie sios irangos  *\r\n* ir (ar) atlikti irangos konfiguracija ar kitus veiksmus, jus turite*\r\n* tureti atitinkama leidima.                                         *\r\n* Uz neteiseta prisijungima bei neteisetus veiksmus su iranga taikoma*\r\n* istatymuose numatyta atsakomybe,iskaitant ir baudziamaja atsakomybe*\r\n* Prasome  atsijungti.Jeigu  jus esate   autorizuotas  vartotojas,   *\r\n* prisijungdamas, jus atsakote uz teisingai atlikta konfiguracija ir *\r\n* kitus savo vardu atliktus veiksmus.                                *\r\n**********************************************************************\r\n* You are connected to private equipment. All the actions performed  *\r\n* with the equipment are recorded. In order to access this equipment *\r\n* and (or) perform its configuration or other  actions, you must have*\r\n* an appropriate permission. Illegal connection and illegal actions  *\r\n* with the equipment.                                                *\r\n* Will be subject to liability, including criminal liability, as     *\r\n* provided for in the laws of the Republic of Lithuania. Please      *\r\n* disconnect immediately. If you are an authorized user, by          *\r\n* connecting  to the equipment, you assume liability for performing  *\r\n* correct configuration and other actions under your behalf.         *\r\n**********************************************************************\r\nUser Authentication\r\npacket_write_wait: Connection to 10.46.1.1 port 22: Broken pipe\r\n",
    "unreachable": true
}

osboxes @ osboxes:〜$ sudo ansible -m ping服务器

osboxes@osboxes:~$ sudo ansible -m ping servers

10.46.1.1 | UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: \r\n**********************************************************************\r\n* Jus esate prisijunge prie privacios irangos. Visi veiksmai,vykdomi *\r\n* su sia iranga, yra fiksuojami. Tam, kad prieiti prie sios irangos  *\r\n* ir (ar) atlikti irangos konfiguracija ar kitus veiksmus, jus turite*\r\n* tureti atitinkama leidima.                                         *\r\n* Uz neteiseta prisijungima bei neteisetus veiksmus su iranga taikoma*\r\n* istatymuose numatyta atsakomybe,iskaitant ir baudziamaja atsakomybe*\r\n* Prasome  atsijungti.Jeigu  jus esate   autorizuotas  vartotojas,   *\r\n* prisijungdamas, jus atsakote uz teisingai atlikta konfiguracija ir *\r\n* kitus savo vardu atliktus veiksmus.                                *\r\n**********************************************************************\r\n* You are connected to private equipment. All the actions performed  *\r\n* with the equipment are recorded. In order to access this equipment *\r\n* and (or) perform its configuration or other  actions, you must have*\r\n* an appropriate permission. Illegal connection and illegal actions  *\r\n* with the equipment.                                                *\r\n* Will be subject to liability, including criminal liability, as     *\r\n* provided for in the laws of the Republic of Lithuania. Please      *\r\n* disconnect immediately. If you are an authorized user, by          *\r\n* connecting  to the equipment, you assume liability for performing  *\r\n* correct configuration and other actions under your behalf.         *\r\n**********************************************************************\r\nUser Authentication\r\nchannel_by_id: 2: bad id: channel free\r\nDisconnecting: Received data for nonexistent channel 2.\r\n",
    "unreachable": true
}

它仅需连接即可立即断开连接,而无需输入任何命令,例如"display version".可能是因为我不是在Cisco设备上运行它,而是在其他供应商上运行它吗?也许需要一些特殊的模块吗?

it just connects and immediatly disconnects without entering any command, like "display version". Could it be because im running it not on Cisco device, but on other vendor ? Maybe some special modules ir required ?

谢谢

推荐答案

您可以使用不同于'shell'的其他模块来访问Huawei设备.如果您在此处看到,您将看到一些Cloud Engine模块. Shell模块用于服务器,而不用于交换机.

You can use other module different from 'shell' to access Huawei equipaments. If you look here you will see some Cloud Engine modules. Shell module is for servers, not for switches.

因此,我将编写如下内容:ansible -m ce_command -a显示版本"服务器

So, I'll would write something like this: ansible -m ce_command -a 'display version' servers

这篇关于默认的ansible模板返回错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆