cisco.nxos icon indicating copy to clipboard operation
cisco.nxos copied to clipboard

MDS Gather Facts

Open feisacrabel opened this issue 4 years ago • 11 comments

SUMMARY

gather facts fail on mds switch

The full traceback is: Traceback (most recent call last): File "/home/feisa/.ansible/tmp/ansible-local-7795104dglkzzy/ansible-tmp-1599779229.9795203-779516-214568281582338/AnsiballZ_nxos_facts.py", line 102, in _ansiballz_main() File "/home/feisa/.ansible/tmp/ansible-local-7795104dglkzzy/ansible-tmp-1599779229.9795203-779516-214568281582338/AnsiballZ_nxos_facts.py", line 94, in _ansiballz_main invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS) File "/home/feisa/.ansible/tmp/ansible-local-7795104dglkzzy/ansible-tmp-1599779229.9795203-779516-214568281582338/AnsiballZ_nxos_facts.py", line 40, in invoke_module runpy.run_module(mod_name='ansible.modules.network.nxos.nxos_facts', 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_nxos_facts_payload_5yla6sqs/ansible_nxos_facts_payload.zip/ansible/modules/network/nxos/nxos_facts.py", line 239, in File "/tmp/ansible_nxos_facts_payload_5yla6sqs/ansible_nxos_facts_payload.zip/ansible/modules/network/nxos/nxos_facts.py", line 230, in main File "/tmp/ansible_nxos_facts_payload_5yla6sqs/ansible_nxos_facts_payload.zip/ansible/module_utils/network/nxos/facts/facts.py", line 68, in get_facts File "/tmp/ansible_nxos_facts_payload_5yla6sqs/ansible_nxos_facts_payload.zip/ansible/module_utils/network/common/facts/facts.py", line 105, in get_network_resources_facts File "/tmp/ansible_nxos_facts_payload_5yla6sqs/ansible_nxos_facts_payload.zip/ansible/module_utils/network/nxos/facts/vlans/vlans.py", line 66, in populate_facts File "/tmp/ansible_nxos_facts_payload_5yla6sqs/ansible_nxos_facts_payload.zip/ansible/module_utils/network/nxos/facts/vlans/vlans.py", line 46, in get_device_data File "/tmp/ansible_nxos_facts_payload_5yla6sqs/ansible_nxos_facts_payload.zip/ansible/module_utils/connection.py", line 185, in rpc ansible.module_utils.connection.ConnectionError: show vlan | json ^ % Invalid command at '^' marker. la3-sanmc001# fatal: [la3-sanmc001]: FAILED! => { "ansible_facts": { "discovered_interpreter_python": "/usr/libexec/platform-python" }, "changed": false, "module_stderr": "Traceback (most recent call last):\n File "/home/feisa/.ansible/tmp/ansible-local-7795104dglkzzy/ansible-tmp-1599779229.9795203-779516-214568281582338/AnsiballZ_nxos_facts.py", line 102, in \n _ansiballz_main()\n File "/home/feisa/.ansible/tmp/ansible-local-7795104dglkzzy/ansible-tmp-1599779229.9795203-779516-214568281582338/AnsiballZ_nxos_facts.py", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File "/home/feisa/.ansible/tmp/ansible-local-7795104dglkzzy/ansible-tmp-1599779229.9795203-779516-214568281582338/AnsiballZ_nxos_facts.py", line 40, in invoke_module\n runpy.run_module(mod_name='ansible.modules.network.nxos.nxos_facts', 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_nxos_facts_payload_5yla6sqs/ansible_nxos_facts_payload.zip/ansible/modules/network/nxos/nxos_facts.py", line 239, in \n File "/tmp/ansible_nxos_facts_payload_5yla6sqs/ansible_nxos_facts_payload.zip/ansible/modules/network/nxos/nxos_facts.py", line 230, in main\n File "/tmp/ansible_nxos_facts_payload_5yla6sqs/ansible_nxos_facts_payload.zip/ansible/module_utils/network/nxos/facts/facts.py", line 68, in get_facts\n File "/tmp/ansible_nxos_facts_payload_5yla6sqs/ansible_nxos_facts_payload.zip/ansible/module_utils/network/common/facts/facts.py", line 105, in get_network_resources_facts\n File "/tmp/ansible_nxos_facts_payload_5yla6sqs/ansible_nxos_facts_payload.zip/ansible/module_utils/network/nxos/facts/vlans/vlans.py", line 66, in populate_facts\n File "/tmp/ansible_nxos_facts_payload_5yla6sqs/ansible_nxos_facts_payload.zip/ansible/module_utils/network/nxos/facts/vlans/vlans.py", line 46, in get_device_data\n File "/tmp/ansible_nxos_facts_payload_5yla6sqs/ansible_nxos_facts_payload.zip/ansible/module_utils/connection.py", line 185, in rpc\nansible.module_utils.connection.ConnectionError: show vlan | json\r\r\n ^\r\n% Invalid command at '^' marker.\r\n\rla3-sanmc001# \n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1 }

ISSUE TYPE
  • Bug Report
COMPONENT NAME

cisco.nxos.nxos_facts

ANSIBLE VERSION

ansible 2.9.13 config file = /home/feisa/ansible-network/ansible.cfg configured module search path = ['/home/feisa/ansible-network/library'] 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)]

CONFIGURATION
OS / ENVIRONMENT

rhel8

STEPS TO REPRODUCE

EXPECTED RESULTS
ACTUAL RESULTS

feisacrabel avatar Sep 10 '20 23:09 feisacrabel

This was supposed to be fixed in https://github.com/ansible-collections/cisco.nxos/issues/46

feisacrabel avatar Sep 10 '20 23:09 feisacrabel

@feisacrabel i dont think this is related to #46 , this is specific to get_facts, its trying to run n7k related cmds (show vlan) which doesnt work on MDS, could you please run MDS modules without get_facts?

srbharadwaj avatar Sep 11 '20 18:09 srbharadwaj

@srbharadwaj do you have a gather facts for mds?

feisacrabel avatar Sep 11 '20 18:09 feisacrabel

@feisacrabel not implemented for mds, we can keep this bug as a placeholder to implement it

srbharadwaj avatar Sep 11 '20 18:09 srbharadwaj

great, hopefully, this is straight forward. Happy to test. I'm migrating hundreds on roles to collections right now

feisacrabel avatar Sep 11 '20 18:09 feisacrabel

@feisacrabel can you please give me the playbook u are using for recreating this issue?

srbharadwaj avatar Sep 12 '20 09:09 srbharadwaj

This is what im runnning

  • name: Gather Nxos Facts nxos_facts: gather_subset: all gather_network_resources: all register: false tags: nxos-gather-facts

feisa avatar Sep 14 '20 20:09 feisa

This is a major enhancement, so considering it for future roadmap item.

srbharadwaj avatar Nov 24 '20 16:11 srbharadwaj

its actually not, it works for the most part you just need to eliminate vlan collecting

feisa avatar Nov 24 '20 16:11 feisa

Its slightly more complicated than that :)

srbharadwaj avatar Nov 24 '20 16:11 srbharadwaj

@NilashishC this more like an enhancement or a feature request, so can you please add feature tag to this?

srbharadwaj avatar Aug 20 '21 03:08 srbharadwaj

Fixed by #595

NilashishC avatar Apr 04 '23 07:04 NilashishC