# nxos\_facts - fails on a lot of versions.

**URL:** <https://forum.ansible.com/t/nxos-facts-fails-on-a-lot-of-versions/28325>\
**Category:** Ansible Project\
**Created:** [August 13, 2018, 10:44pm UTC](https://forum.ansible.com/t/nxos-facts-fails-on-a-lot-of-versions/28325 "2018-08-13T22:44:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dennis\_McCarthy](https://avatars.discourse-cdn.com/v4/letter/d/c2a13f/32.png) [@Dennis\_McCarthy](https://forum.ansible.com/u/Dennis_McCarthy)\
**Post date:** [August 13, 2018, 10:44pm UTC](https://forum.ansible.com/t/nxos-facts-fails-on-a-lot-of-versions/28325/1 "2018-08-13T22:44:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Jonathan\_Lozada\_De\_L](https://avatars.discourse-cdn.com/v4/letter/j/eb8c5e/32.png) [@Jonathan\_Lozada\_De\_L](https://forum.ansible.com/u/Jonathan_Lozada_De_L)\
**Post date:** [August 13, 2018, 10:55pm UTC](https://forum.ansible.com/t/nxos-facts-fails-on-a-lot-of-versions/28325/2 "2018-08-13T22:55:06Z")

</div>

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](https://docs.ansible.com/ansible/2.5/network/user_guide/platform_nxos.html#nxos-platform-options)?

---

<div class="post-metadata">

**Author:** ![trishna](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/trishna/32/963_2.png) [@trishna](https://forum.ansible.com/u/trishna)\
**Post date:** [August 14, 2018, 4:53am UTC](https://forum.ansible.com/t/nxos-facts-fails-on-a-lot-of-versions/28325/3 "2018-08-14T04:53:20Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![Dennis\_McCarthy](https://avatars.discourse-cdn.com/v4/letter/d/c2a13f/32.png) [@Dennis\_McCarthy](https://forum.ansible.com/u/Dennis_McCarthy)\
**Post date:** [August 14, 2018, 4:14pm UTC](https://forum.ansible.com/t/nxos-facts-fails-on-a-lot-of-versions/28325/4 "2018-08-14T16:14:51Z")

</div>

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’”

---

<div class="post-metadata">

**Author:** ![Dennis\_McCarthy](https://avatars.discourse-cdn.com/v4/letter/d/c2a13f/32.png) [@Dennis\_McCarthy](https://forum.ansible.com/u/Dennis_McCarthy)\
**Post date:** [August 14, 2018, 6:53pm UTC](https://forum.ansible.com/t/nxos-facts-fails-on-a-lot-of-versions/28325/5 "2018-08-14T18:53:18Z")

</div>

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  
}
