我的代码的目的是从配置中过滤特定的路由实例名称。
我的搜索是在 configuration-> Routing -Instances->Instance -> name -> MY RI 中的路由实例以及所有具有 MY RI 的行我对 Filter 和传递 kwargs 没问题,但我遇到了问题。
代码:
---
- name: Get RI
hosts: junos Host
connection: local
gather_facts: no
roles:
- Juniper.junos
tasks:
- name: send rpc with args
juniper_junos_rpc:
host: "{{ inventory_hostname }}"
user: "user"
passwd: "pssword!"
rpc: get-config
logfile: 'rpc.log'
format: xml
dest: "{{ inventory_hostname }}.xml"
kwargs:
filter_xml: configuration/routing-instances/instance/name = CSP-RI-L2-cc6abb1d-63ab-483f-b4ce-f4b978c877cc
**ERROR**
error:fatal: [sit-entce.tlab.equinix.com]: FAILED! => {
"changed": false,
"module_stderr": "/usr/lib/python2.7/dist-packages/Crypto/Cipher/blockalgo.py:141: FutureWarning: CTR mode needs counter parameter, not IV\n self._cipher = factory.new(key, *args, **kwargs)\nTraceback (most recent call last):\n File \"/tmp/ansible_T0LCbD/ansible_module_juniper_junos_rpc.py\", line 622, in <module>\n main()\n File \"/tmp/ansible_T0LCbD/ansible_module_juniper_junos_rpc.py\", line 518, in main\n options=attr, **kwarg)\nTypeError: get_config() got multiple values for keyword argument 'filter_xml'\n",
"module_stdout": "",
"msg": "MODULE FAILURE",
"rc": 1
有什么建议么。会有多个 RI,我必须搜索一个 RI 并打印它或存储所有具有该 RI 名称的行