---
- name: Get vfabric ID
netconf_rpc:
display: xml
rpc: get
content: |
<filter type="subtree">
<Fabric xmlns="urn:vendor:faas:fabrics">
<FabricID>{{fabric}}</FabricID>
<Node>
<NodeID/>
<Name/>
</Node>
</Fabric>
</filter>
register: list
- name: debug
debug:
msg: " {{list}} "
- name: Parse xml
xml:
xmlstring: "{{ list.output }}"
xpath: "/data/Fabric/Node[Name='{{item.name}}']/NodeID"
content: text
register: result
- name: Extract node-id
set_fact:
nodeID: "{{ result['matches'][0]['NodeID'] }}"
- name: rename TP
debug:
msg: "Fabric: {{fabric}} - Leaf: {{item.name}} - ID: {{nodeID}} "
EXPECTED RESULTS
That the get command should work and return contents
ACTUAL RESULTS
{
"module_stdout": "",
"module_stderr": "Traceback (most recent call last):\n File \"/tmp/ansible_netconf_rpc_payload_e8tllabr/ansible_netconf_rpc_payload.zip/ansible/module_utils/connection.py\", line 156, in _exec_jsonrpc\n File \"/usr/lib64/python3.6/json/__init__.py\", line 354, in loads\n return _default_decoder.decode(s)\n File \"/usr/lib64/python3.6/json/decoder.py\", line 339, in decode\n obj, end = self.raw_decode(s, idx=_w(s, 0).end())\n File \"/usr/lib64/python3.6/json/decoder.py\", line 357, in raw_decode\n raise JSONDecodeError(\"Expecting value\", s, err.value) from None\njson.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/var/lib/awx/.ansible/tmp/ansible-local-2tq6u897x/ansible-tmp-1602699898.397022-92-145463566026323/AnsiballZ_netconf_rpc.py\", line 102, in <module>\n _ansiballz_main()\n File \"/var/lib/awx/.ansible/tmp/ansible-local-2tq6u897x/ansible-tmp-1602699898.397022-92-145463566026323/AnsiballZ_netconf_rpc.py\", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/var/lib/awx/.ansible/tmp/ansible-local-2tq6u897x/ansible-tmp-1602699898.397022-92-145463566026323/AnsiballZ_netconf_rpc.py\", line 40, in invoke_module\n runpy.run_module(mod_name='ansible.modules.network.netconf.netconf_rpc', init_globals=None, run_name='__main__', alter_sys=True)\n File \"/usr/lib64/python3.6/runpy.py\", line 205, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib64/python3.6/runpy.py\", line 96, in _run_module_code\n mod_name, mod_spec, pkg_name, script_name)\n File \"/usr/lib64/python3.6/runpy.py\", line 85, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_netconf_rpc_payload_e8tllabr/ansible_netconf_rpc_payload.zip/ansible/modules/network/netconf/netconf_rpc.py\", line 264, in <module>\n File \"/tmp/ansible_netconf_rpc_payload_e8tllabr/ansible_netconf_rpc_payload.zip/ansible/modules/network/netconf/netconf_rpc.py\", line 240, in main\n File \"/tmp/ansible_netconf_rpc_payload_e8tllabr/ansible_netconf_rpc_payload.zip/ansible/module_utils/network/netconf/netconf.py\", line 119, in dispatch\n File \"/tmp/ansible_netconf_rpc_payload_e8tllabr/ansible_netconf_rpc_payload.zip/ansible/module_utils/network/netconf/netconf.py\", line 41, in get_connection\n File \"/tmp/ansible_netconf_rpc_payload_e8tllabr/ansible_netconf_rpc_payload.zip/ansible/module_utils/network/netconf/netconf.py\", line 55, in get_capabilities\n File \"/tmp/ansible_netconf_rpc_payload_e8tllabr/ansible_netconf_rpc_payload.zip/ansible/module_utils/connection.py\", line 179, in __rpc__\n File \"/tmp/ansible_netconf_rpc_payload_e8tllabr/ansible_netconf_rpc_payload.zip/ansible/module_utils/connection.py\", line 161, in _exec_jsonrpc\nansible.module_utils.connection.ConnectionError: Unable to decode JSON from response to get_capabilities(). Received 'None'.\n",
"exception": "Traceback (most recent call last):\n File \"/tmp/ansible_netconf_rpc_payload_e8tllabr/ansible_netconf_rpc_payload.zip/ansible/module_utils/connection.py\", line 156, in _exec_jsonrpc\n File \"/usr/lib64/python3.6/json/__init__.py\", line 354, in loads\n return _default_decoder.decode(s)\n File \"/usr/lib64/python3.6/json/decoder.py\", line 339, in decode\n obj, end = self.raw_decode(s, idx=_w(s, 0).end())\n File \"/usr/lib64/python3.6/json/decoder.py\", line 357, in raw_decode\n raise JSONDecodeError(\"Expecting value\", s, err.value) from None\njson.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/var/lib/awx/.ansible/tmp/ansible-local-2tq6u897x/ansible-tmp-1602699898.397022-92-145463566026323/AnsiballZ_netconf_rpc.py\", line 102, in <module>\n _ansiballz_main()\n File \"/var/lib/awx/.ansible/tmp/ansible-local-2tq6u897x/ansible-tmp-1602699898.397022-92-145463566026323/AnsiballZ_netconf_rpc.py\", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/var/lib/awx/.ansible/tmp/ansible-local-2tq6u897x/ansible-tmp-1602699898.397022-92-145463566026323/AnsiballZ_netconf_rpc.py\", line 40, in invoke_module\n runpy.run_module(mod_name='ansible.modules.network.netconf.netconf_rpc', init_globals=None, run_name='__main__', alter_sys=True)\n File \"/usr/lib64/python3.6/runpy.py\", line 205, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib64/python3.6/runpy.py\", line 96, in _run_module_code\n mod_name, mod_spec, pkg_name, script_name)\n File \"/usr/lib64/python3.6/runpy.py\", line 85, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_netconf_rpc_payload_e8tllabr/ansible_netconf_rpc_payload.zip/ansible/modules/network/netconf/netconf_rpc.py\", line 264, in <module>\n File \"/tmp/ansible_netconf_rpc_payload_e8tllabr/ansible_netconf_rpc_payload.zip/ansible/modules/network/netconf/netconf_rpc.py\", line 240, in main\n File \"/tmp/ansible_netconf_rpc_payload_e8tllabr/ansible_netconf_rpc_payload.zip/ansible/module_utils/network/netconf/netconf.py\", line 119, in dispatch\n File \"/tmp/ansible_netconf_rpc_payload_e8tllabr/ansible_netconf_rpc_payload.zip/ansible/module_utils/network/netconf/netconf.py\", line 41, in get_connection\n File \"/tmp/ansible_netconf_rpc_payload_e8tllabr/ansible_netconf_rpc_payload.zip/ansible/module_utils/network/netconf/netconf.py\", line 55, in get_capabilities\n File \"/tmp/ansible_netconf_rpc_payload_e8tllabr/ansible_netconf_rpc_payload.zip/ansible/module_utils/connection.py\", line 179, in __rpc__\n File \"/tmp/ansible_netconf_rpc_payload_e8tllabr/ansible_netconf_rpc_payload.zip/ansible/module_utils/connection.py\", line 161, in _exec_jsonrpc\nansible.module_utils.connection.ConnectionError: Unable to decode JSON from response to get_capabilities(). Received 'None'.\n",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1,
"_ansible_no_log": false,
"changed": false
}
SUMMARY
When running a play such as the play below we receive a traceback. ` - name: Get vfabric ID netconf_rpc: display: xml rpc: get content: |
`
ISSUE TYPE
COMPONENT NAME
netconf_rpc
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
RHEL8 VM on KVM
STEPS TO REPRODUCE
Run the playbook
EXPECTED RESULTS
That the get command should work and return contents
ACTUAL RESULTS