Skip to content

Instantly share code, notes, and snippets.

@ganeshrn
Last active December 14, 2020 04:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ganeshrn/f763e299cb4896b548c586b57041ee73 to your computer and use it in GitHub Desktop.
Save ganeshrn/f763e299cb4896b548c586b57041ee73 to your computer and use it in GitHub Desktop.
Get interface state in structured format on nxos
---
- hosts: nxos
connection: ansible.netcommon.network_cli
gather_facts: false
vars:
ansible_network_os: cisco.nxos.nxos
ansible_user: "changeme"
ansible_password: "changeme"
tasks:
- name: "Fetch interface state and parse with pyats"
ansible.utils.cli_parse:
command: show interface
parser:
name: ansible.netcommon.pyats
register: nxos_pyats_show_interface
- name: print structured interface state data
ansible.builtin.debug:
msg: "{{ nxos_pyats_show_interface['parsed'] }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment