It seems to be an issue within Ansible while trying to remove namespace from received XML response. Please check it the PR https://github.com/ansible-collections/ansible.netcommon/pull/152 fixes the issue you are seeing.
> On Fri, Oct 2, 2020 at 12:14 AM angelo coluni <[email protected]> wrote: > >> Here is the output..I cannot see any issue >> >> thanks >> >> 2020-10-01 14:08:46,140 p=862827 u=root n=ncclient.transport.ssh | >> [host 10.212.12.16 session-id 148] Received message from host >> 2020-10-01 14:08:46,141 p=862827 u=root n=ansible | jsonrpc response: >> {"jsonrpc": "2.0", "id": "d9df6042-c78a-486a-b9c3-6e2b38083fb6", >> "result": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><data >> xmlns:fabrics=\"urn:kaloom:faas:fabrics\" >> xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\" >> >> xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\"><fabrics:Fabric><fabrics:FabricID>212</fabrics:FabricID><fabrics:Node><fabrics:NodeID>e9fa6779-c667-4733-8db2-61f904b8205e</fabrics:NodeID><fabrics:Name>aj08025933-upf-31u</fabrics:Name></fabrics:Node><fabrics:Node><fabrics:NodeID>ab48b157-fd08-46af-9355-5384e90979b4</fabrics:NodeID><fabrics:Name>ak18000735-leaf-29u</fabrics:Name></fabrics:Node><fabrics:Node><fabrics:NodeID>1c6e769f-02f0-41f7-a0f5-957d54d6e788</fabrics:NodeID><fabrics:Name>controller-1</fabrics:Name></fabrics:Node></fabrics:Fabric></data>"} >> 2020-10-01 14:08:46,161 p=862943 u=root n=ansible | <10.212.12.16> >> EXEC /bin/sh -c 'rm -f -r >> >> /root/.ansible/tmp/ansible-local-862814_qg5scng/ansible-tmp-1601575725.3798058-862943-225523550103615/ >> > /dev/null 2>&1 && sleep 0' >> 2020-10-01 14:08:46,174 p=862814 u=root n=ansible | The full traceback is: >> Traceback (most recent call last): >> File >> "/root/.ansible/tmp/ansible-local-862814_qg5scng/ansible-tmp-1601575725.3798058-862943-225523550103615/AnsiballZ_netconf_rpc.py", >> line 102, in <module> >> _ansiballz_main() >> File >> "/root/.ansible/tmp/ansible-local-862814_qg5scng/ansible-tmp-1601575725.3798058-862943-225523550103615/AnsiballZ_netconf_rpc.py", >> line 94, in _ansiballz_main >> invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS) >> File >> "/root/.ansible/tmp/ansible-local-862814_qg5scng/ansible-tmp-1601575725.3798058-862943-225523550103615/AnsiballZ_netconf_rpc.py", >> line 40, in invoke_module >> >> runpy.run_module(mod_name='ansible.modules.network.netconf.netconf_rpc', >> init_globals=None, run_name='__main__', alter_sys=True) >> File "/usr/lib64/python3.6/runpy.py", line 205, in run_module >> return _run_module_code(code, init_globals, run_name, mod_spec) >> File "/usr/lib64/python3.6/runpy.py", line 96, in _run_module_code >> mod_name, mod_spec, pkg_name, script_name) >> File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code >> exec(code, run_globals) >> File >> "/tmp/ansible_netconf_rpc_payload_ci30aiuw/ansible_netconf_rpc_payload.zip/ansible/modules/network/netconf/netconf_rpc.py", >> line 264, in <module> >> File >> "/tmp/ansible_netconf_rpc_payload_ci30aiuw/ansible_netconf_rpc_payload.zip/ansible/modules/network/netconf/netconf_rpc.py", >> line 246, in main >> File >> "/tmp/ansible_netconf_rpc_payload_ci30aiuw/ansible_netconf_rpc_payload.zip/ansible/module_utils/network/common/netconf.py", >> line 141, in remove_namespaces >> File "/usr/local/lib/python3.6/site-packages/ncclient/xml_.py", line >> 174, in __init__ >> self.__doc = self.remove_namespaces(self.__result) >> File "/usr/local/lib/python3.6/site-packages/ncclient/xml_.py", line >> 222, in remove_namespaces >> parser=self.__parser))), >> File "src/lxml/etree.pyx", line 3467, in lxml.etree.parse >> File "src/lxml/parser.pxi", line 1856, in lxml.etree._parseDocument >> File "src/lxml/parser.pxi", line 1876, in >> lxml.etree._parseMemoryDocument >> File "src/lxml/parser.pxi", line 1757, in lxml.etree._parseDoc >> File "src/lxml/parser.pxi", line 1068, in >> lxml.etree._BaseParser._parseUnicodeDoc >> File "src/lxml/parser.pxi", line 601, in >> lxml.etree._ParserContext._handleParseResultDoc >> File "src/lxml/parser.pxi", line 711, in lxml.etree._handleParseResult >> File "src/lxml/parser.pxi", line 640, in lxml.etree._raiseParseError >> File "<string>", line 1 >> lxml.etree.XMLSyntaxError: Start tag expected, '<' not found, line 1, >> column 1 >> >> On Thu, Oct 1, 2020 at 11:59 AM Ganesh Nalawade <[email protected]> >> wrote: >> > >> > It looks like it is failing while parsing the response. >> > Please enable the persistent logging to identify exactly which RPC >> response is failing >> > Refer: >> https://docs.ansible.com/ansible/devel/network/user_guide/network_debug_troubleshooting.html#enabling-networking-device-interaction-logging >> > >> > >> > On Thu, Oct 1, 2020 at 9:11 PM angelo coluni <[email protected]> >> wrote: >> >> >> >> jxmlease is required if we want to display and store response in json, >> >> however if we want output to be xml we need lxml >> >> issue seems to be in removing name space from rpc reply , this could >> >> be ansible issue >> >> >> >> thanks >> >> >> >> ex: >> >> --- >> >> - name: xml >> >> netconf_rpc: >> >> rpc: get >> >> display: xml >> >> content: | >> >> <filter type="subtree"> >> >> < payload > >> >> </filter> >> >> register: out <--- fails >> >> >> >> >> >> On Thu, Oct 1, 2020 at 8:50 AM Dick Visser <[email protected]> >> wrote: >> >> > >> >> > The netconf_rpc module does not require lxml, but jxmlease instead. >> >> > Make sure that is installed (as per docs >> >> > >> https://docs.ansible.com/ansible/latest/collections/ansible/netcommon/netconf_rpc_module.html#requirements >> ). >> >> > >> >> > This is true for both of your python environments. >> >> > Probably 'pip list' will show it's installed, while 'pip3 list' >> won't. >> >> > >> >> > DIck >> >> > >> >> > On Thu, 1 Oct 2020 at 14:38, angelo coluni <[email protected]> >> wrote: >> >> > > >> >> > > Setup: >> >> > > >> >> > > ansible 2.9.13 >> >> > > config file = /etc/ansible/ansible.cfg >> >> > > configured module search path = >> ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] >> >> > > ansible python module location = >> /usr/lib/python3.6/site-packages/ansible >> >> > > executable location = /usr/bin/ansible >> >> > > python version = 3.6.8 (default, Dec 5 2019, 15:45:45) [GCC >> 8.3.1 20191121 (Red Hat 8.3.1-5)] >> >> > > >> >> > > installed lxml-4.5.2 ncclient-0.6.9 >> >> > > >> >> > > Having an issue in ansible when using module netconf_rpc, the >> following error occurs, however when I change interpreter_python = >> /usr/bin/python2.7 error is not present >> >> > > >> >> > > Any reason what can be causing this issue >> >> > > >> >> > > thanks.. >> >> > > >> >> > > >> >> > > <10.10.10.10> EXEC /bin/sh -c '/usr/bin/python3.6 >> /root/.ansible/tmp/ansible-local-9652MobtmE/ansible-tmp-1601554935.02-9754-119778420816035/AnsiballZ_netconf_rpc.py >> && sleep 0' >> >> > > <10.10.10.10> EXEC /bin/sh -c 'rm -f -r >> /root/.ansible/tmp/ansible-local-9652MobtmE/ansible-tmp-1601554935.02-9754-119778420816035/ >> > /dev/null 2>&1 && sleep 0' >> >> > > The full traceback is: >> >> > > Traceback (most recent call last): >> >> > > File >> "/root/.ansible/tmp/ansible-local-9652MobtmE/ansible-tmp-1601554935.02-9754-119778420816035/AnsiballZ_netconf_rpc.py", >> line 102, in <module> >> >> > > _ansiballz_main() >> >> > > File >> "/root/.ansible/tmp/ansible-local-9652MobtmE/ansible-tmp-1601554935.02-9754-119778420816035/AnsiballZ_netconf_rpc.py", >> line 94, in _ansiballz_main >> >> > > invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS) >> >> > > File >> "/root/.ansible/tmp/ansible-local-9652MobtmE/ansible-tmp-1601554935.02-9754-119778420816035/AnsiballZ_netconf_rpc.py", >> line 40, in invoke_module >> >> > > >> runpy.run_module(mod_name='ansible.modules.network.netconf.netconf_rpc', >> init_globals=None, run_name='__main__', alter_sys=True) >> >> > > File "/usr/lib64/python3.6/runpy.py", line 205, in run_module >> >> > > return _run_module_code(code, init_globals, run_name, mod_spec) >> >> > > File "/usr/lib64/python3.6/runpy.py", line 96, in >> _run_module_code >> >> > > mod_name, mod_spec, pkg_name, script_name) >> >> > > File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code >> >> > > exec(code, run_globals) >> >> > > File >> "/tmp/ansible_netconf_rpc_payload_t8kmcb46/ansible_netconf_rpc_payload.zip/ansible/modules/network/netconf/netconf_rpc.py", >> line 264, in <module> >> >> > > File >> "/tmp/ansible_netconf_rpc_payload_t8kmcb46/ansible_netconf_rpc_payload.zip/ansible/modules/network/netconf/netconf_rpc.py", >> line 246, in main >> >> > > File >> "/tmp/ansible_netconf_rpc_payload_t8kmcb46/ansible_netconf_rpc_payload.zip/ansible/module_utils/network/common/netconf.py", >> line 141, in remove_namespaces >> >> > > File "/usr/local/lib/python3.6/site-packages/ncclient/xml_.py", >> line 174, in __init__ >> >> > > self.__doc = self.remove_namespaces(self.__result) >> >> > > File "/usr/local/lib/python3.6/site-packages/ncclient/xml_.py", >> line 222, in remove_namespaces >> >> > > parser=self.__parser))), >> >> > > File "src/lxml/etree.pyx", line 3521, in lxml.etree.parse >> >> > > File "src/lxml/parser.pxi", line 1876, in >> lxml.etree._parseDocument >> >> > > File "src/lxml/parser.pxi", line 1896, in >> lxml.etree._parseMemoryDocument >> >> > > File "src/lxml/parser.pxi", line 1777, in lxml.etree._parseDoc >> >> > > File "src/lxml/parser.pxi", line 1082, in >> lxml.etree._BaseParser._parseUnicodeDoc >> >> > > File "src/lxml/parser.pxi", line 615, in >> lxml.etree._ParserContext._handleParseResultDoc >> >> > > File "src/lxml/parser.pxi", line 725, in >> lxml.etree._handleParseResult >> >> > > File "src/lxml/parser.pxi", line 654, in >> lxml.etree._raiseParseError >> >> > > File "<string>", line 1 >> >> > > lxml.etree.XMLSyntaxError: Start tag expected, '<' not found, line >> 1, column 1 >> >> > > >> >> > > >> >> > > -- >> >> > > You received this message because you are subscribed to the Google >> Groups "Ansible Project" group. >> >> > > To unsubscribe from this group and stop receiving emails from it, >> send an email to [email protected]. >> >> > > To view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/0016a4fb-7e0e-41e1-8741-952d9d9517a9n%40googlegroups.com >> . >> >> > >> >> > >> >> > >> >> > -- >> >> > Dick Visser >> >> > Trust & Identity Service Operations Manager >> >> > GÉANT >> >> > >> >> > -- >> >> > You received this message because you are subscribed to the Google >> Groups "Ansible Project" group. >> >> > To unsubscribe from this group and stop receiving emails from it, >> send an email to [email protected]. >> >> > To view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/CAL8fbwOvbm51PfEgVeRwveRCbeBgdOBLCwEY%3DZDgTrqH7jFD%2BA%40mail.gmail.com >> . >> >> >> >> -- >> >> You received this message because you are subscribed to the Google >> Groups "Ansible Project" group. >> >> To unsubscribe from this group and stop receiving emails from it, send >> an email to [email protected]. >> >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/CALdgpW4it0_o0n3ZEdSv3Rxab2x1mMaY76cqg3hh8p5m5szKsg%40mail.gmail.com >> . >> > >> > >> > >> > -- >> > Regards, >> > Ganesh >> > >> > -- >> > You received this message because you are subscribed to the Google >> Groups "Ansible Project" group. >> > To unsubscribe from this group and stop receiving emails from it, send >> an email to [email protected]. >> > To view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/CA%2B6y2sHJoWj_%2B01reYObTsTjJRxGStDAosZrn6PFJsXRrQXUXw%40mail.gmail.com >> . >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ansible Project" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/CALdgpW4RF_oMfWXAzTVKc24%3Dur%3D3aaG%2BCMgTJHkJ4ACJjHSZzQ%40mail.gmail.com >> . >> > > > -- > Regards, > Ganesh > > -- Regards, Ganesh -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CA%2B6y2sE5PSoGyQJ7KtmwQ1y6V9ebyzWsd%2BUcSAqW74mqfTwELw%40mail.gmail.com.
