12-30-2016 05:16 AM
Hi
Today I tried to do some testing with automation on the Nexus 7700 with Ansible. The Ansible Modules for nxos wants it output in Json format.
So Ansible adds ad the end of every command "| json". The Nexus should support this. But I always get the error, that Python cannot load the modul xmltodict.
Even If try for example the command directly on the cli "show version | json" I get the same, like with ansible, error:
XX# show version | json
Traceback (most recent call last):
File "/isan/python/scripts/pipejson.py", line 3, in <module>
import os, sys, shlex, json, xmltodict, re, fnmatch
ImportError: No module named xmltodict
Thanks and cheers, Kevin
BIOS: version 3.1.0
kickstart: version 7.2(0)D1(1)
system: version 7.2(0)D1(1)
Solved! Go to Solution.
02-27-2017 03:47 AM
The new version 7.2(2)D1(2) fixed this issue.
02-27-2017 03:47 AM
The new version 7.2(2)D1(2) fixed this issue.
09-27-2017 12:40 PM
In case you are on an older version of NXOS, the nxos_facts module is great at this. I have a playbook here: https://github.com/network-automation/ansible-napalm-samples/blob/master/showversion.yml
--- - hosts: cisco connection: local gather_facts: False tasks: - name: run show version nxos_facts: provider: "{{login_info}}" - debug: var: ansible_net_version
09-29-2017 12:02 AM
Hi Tanks for your reply!
can you make "show version | json "
it looks like in my version they forgot to place the python modul (xmltodict.py) in /isan/python/scipts/.
But I find nowhere any changelog about this issue.
Do you know can I somehow place files in this locations?
Cheers, Kevin
09-29-2017 12:15 AM
ah I see you are using n9k ;)
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide