nxos_facts - fails on a lot of versions.

I’m running ansible 2.5.5-1.
It seems that the issue I have where the nxos_module spits out an error seem to be related to the version or image on the device I’m trying to connect to.
I think the error is saying that the object containing stdout doesn’t have a get() method. “unicode”, that there is like a sub-class of string, right?

I’m reading thru issues on git-hub, but they talk way over my head.
ELI5 (Explain it Like I’m 5);
IS this fixed in 2.6?
Is this a “too bad, so sad” sort of issue where I just need to get newer switches or older ansible?

The Error:

fatal: [NDDCBPSWNX01]: FAILED! => changed=false
module_stderr: |-
Traceback (most recent call last):
File “/tmp/ansible_5wMQsv/ansible_module_nxos_facts.py”, line 602, in
main()
File “/tmp/ansible_5wMQsv/ansible_module_nxos_facts.py”, line 585, in main
inst.populate()
File “/tmp/ansible_5wMQsv/ansible_module_nxos_facts.py”, line 233, in populate
if data.get(‘sys_ver_str’):
AttributeError: ‘unicode’ object has no attribute ‘get’
module_stdout: ‘’
msg: MODULE FAILURE
rc: 1
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: ‘unicode’ object has no attribute ‘get’

The results of my testing:

Connection IOSVersion
Failed 5.2(1)N1(1), RELEASE SOFTWARE Copyright (c) 2002-2011 by Cisco Systems, Inc. Device Manager Version 6.1(1), Compiled 7/12/2012 19:00:00
Worked 6.0(2)A6(4), RELEASE SOFTWARE Copyright (c) 2002-2012 by Cisco Systems, Inc. Compiled 8/18/2015 13:00:00
Worked 6.0(2)A8(3), RELEASE SOFTWARE Copyright (c) 2002-2012 by Cisco Systems, Inc. Compiled 10/28/2016 20:00:00
Failed 6.0(2)N1(2), RELEASE SOFTWARE Copyright (c) 2002-2012 by Cisco Systems, Inc. Device Manager Version 6.0(2)N1(1), Compiled 3/14/2013 1:00:00
Worked 6.0(2)U6(10), RELEASE SOFTWARE Copyright (c) 2002-2012 by Cisco Systems, Inc. Compiled 3/30/2017 9:00:00
Failed 6.0(4), RELEASE SOFTWARE Copyright (c) 2002-2011 by Cisco Systems, Inc. Compiled 6/6/2012 18:00:00
Failed 6.1(2), RELEASE SOFTWARE Copyright (c) 2002-2012 by Cisco Systems, Inc. Compiled 9/7/2012 13:00:00
Failed 6.2(16), RELEASE SOFTWARE Copyright (c) 2002-2013 by Cisco Systems, Inc. Compiled 1/27/2016 9:00:00
Failed 7.0(1)N1(1), RELEASE SOFTWARE Copyright (c) 2002-2012 by Cisco Systems, Inc. Device Manager Version 6.3(1), Compiled 3/19/2014 14:00:00
Worked 7.0(3)I2(2a), RELEASE SOFTWARE Copyright (c) 2002-2013 by Cisco Systems, Inc. Compiled 12/14/2015 3:00:00
Worked 7.0(3)I2(2b), RELEASE SOFTWARE Copyright (c) 2002-2013 by Cisco Systems, Inc. Compiled 2/28/2016 19:00:00
Worked 7.0(3)I5(1), RELEASE SOFTWARE Copyright (c) 2002-2016 by Cisco Systems, Inc. Compiled 10/29/2016 8:00:00
Worked 7.3(2)N1(1), RELEASE SOFTWARE Copyright (c) 2002-2012, 2016-2017 by Cisco Systems, Inc. Device Manager Version 6.0(2)N1(1),Compiled 5/12/2017 23:00:00

Dennis,

I’m not an expert on networking but, we can try to gather some information and track it down. How does your playbook/role look like ? did you follow the instructions in here https://docs.ansible.com/ansible/2.5/network/user_guide/platform_nxos.html#nxos-platform-options?

Hi,

You are getting this error on 5.2(1)N1(1) Nexus as JSON structured output is not supported on the device.
Non structured output support for this module is added in 2.6. Please upgrade to Ansible 2.6.2.

Thanks,

Jonathan,
Your response sounds like you’ve never heard this sort of thing before, which kinda strike me as odd in light of the issues in github.
But yes, I’ve followed the recommendations you reference.
Here is an example of the one of the many tasks that produce this type of error:

  • name: “Gathering HW Facts”
    nxos_facts:
    gather_subset: default
    provider: “{{ provider }}”
    register: “hw_facts”
    when: “os ==‘nxos’”

Ok, so I bit the bullet and upgraded to ansible 2.6.2.

The nxos_facts command no longer blows up on the older images.
It doesn’t return any actual facts either, but not blowing up is good - maybe. I do like the idea of failing early and failing loudly.

“hw_facts”: {
“ansible_facts”: {
“ansible_net_gather_subset”: [
“default”
],
“ansible_net_hostname”: null,
“ansible_net_image”: null,
“ansible_net_model”: null,
“ansible_net_serialnum”: null,
“ansible_net_version”: null
},
“changed”: false,
“failed”: false
}