Skip to content

mj8mj4/ansible_helpers

 
 

Repository files navigation

ansible_helpers

Ansible plugins and modules to make network automation easier.


Using net_txtfsm_parse filter

Purpose

Convert unstructured data from Ansible core networking modules (like ios_command, eos_command, nxos_command) into structured data using TextFSM templates.

Example Use

# Send output through the filter (specify two arguments platform and command)
- debug:
    msg: "{{ output | net_textfsm_parse('cisco_ios', 'show ip int brief') }}"

Setup

# Clone this repository
git clone https://github.com/ktbyers/ansible_helpers

# Get ntc-templates
git clone https://github.com/networktocode/ntc-templates

# PIP install any of the dependencies specified in requirements.txt
pip install -r /path/to/ansible_helpers/requirements.txt

# Setup environment variable
export NET_TEXTFSM=/path/to/ntc-templates/templates/

# Copy /path/to/ansible_helpers/filter_plugins to either:
1. ./filter_plugins directory relative to your playbook
2. a central filter_plugins directory as specified in your .ansible.cfg

More Detailed Example

See https://github.com/ktbyers/ansible_helpers/blob/master/simple_example.yml

About

Ansible plugins and modules to make network automation easier.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%