Cisco Facts and Genie Parsed Commands to Business-Ready Documentation Ansible Playbooks
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
- Install Ansible
pip install --user ansible
- Check version of Ansible
ansible --version
ansible 2.9.1
- Install JMESPATH
pip install --user jmespath
- Install Genie
- Install node.js 12
curl -sL https://rpm.nodesource.com/setup_12.x | sudo bash -
- Install GCC
sudo yum install -y gcc-c++ make
- Install Node.js
sudo yum install -y nodejs
- Install Mark Map
npm install markmap-lib -g
- Clone the Repository
git clone https://github.com/automateyournetwork/Cisco_Facts
IOS and NXOS Facts
-
Update your hosts to match your CAMPUS or DC first. Make sure you have SSH connectivity from the Ansible host.
-
Run the ansible-playbook of choice
-
Supply Username
-
Supply Secret
-
Git add / commit / push created output files
-
Check output .CSV files
-
Check output .MD files
-
Check output .HTML files