Cisco Facts and Genie Parsed Commands to Business-Ready Documentation Ansible Playbooks

published

Written by John Capobianco

Ansible has several "Facts" modules - ios_facts and nxos_facts - that capture data and transform it into JavaScript Object Notation (JSON) which we then use Jinja2 Templates to transform again into business-ready documentation

Cisco also has release Genie parsers - combined with Ansible you can first run an IOS / NXOS show command, then with Genie, parse that command into JSON. Once you have the JSON you can transform it with Jinja2 into CSV / MD!

Prerequisites

  1. Install Ansible
pip install --user ansible
  1. Check version of Ansible
ansible --version

ansible 2.9.1
  1. Install JMESPATH
pip install --user jmespath
  1. Install Genie
pip install genie
  1. Install node.js 12
curl -sL https://rpm.nodesource.com/setup_12.x | sudo bash -
  1. Install GCC
sudo yum install -y gcc-c++ make
  1. Install Node.js
sudo yum install -y nodejs
  1. Install Mark Map
npm install markmap-lib -g  
  1. Clone the Repository
git clone https://github.com/automateyournetwork/Cisco_Facts

IOS and NXOS Facts

  1. Update your hosts to match your CAMPUS or DC first. Make sure you have SSH connectivity from the Ansible host.

  2. Run the ansible-playbook of choice

  3. Supply Username

  4. Supply Secret

  5. Git add / commit / push created output files

  6. Check output .CSV files

  7. Check output .MD files

  8. Check output .HTML files

View code on GitHub

Code Exchange Community

Get help, share code, and collaborate with other developers in the Code Exchange community.View Community
Disclaimer:
Cisco provides Code Exchange for convenience and informational purposes only, with no support of any kind. This page contains information and links from third-party websites that are governed by their own separate terms. Reference to a project or contributor on this page does not imply any affiliation with or endorsement by Cisco.