我正在尝试使用 ansible 在瞻博网络设备上自动执行某些命令。但是命令要求我使用'|' (管道)。阅读 Junos_command 模块文档,无法使用管道。
This module does NOT use the Junos CLI to execute the CLI command. Instead, it uses the <command> RPC over a NETCONF channel. The <command> RPC takes a CLI command as it’s input and is very similar to executing the command on the CLI, but you can NOT include any pipe modifies (i.e. | match, | count, etc.) with the CLI commands executed by this module.
我尝试使用转义字符\
,但它仍然不起作用。
我想到的是通过 ansible 使用原始 shell 命令来 ssh 到设备并运行命令(独立于 junos_command 模块),但这似乎需要做很多工作,而且我放弃了很多有用的功能,因为不使用该模块。
我可以使用哪些其他方法来使用此模块实际通过管道传递命令。