Welcome to nornir’s documentation!¶
Nornir is an automation framework written in python to be used with python. Most automation frameworks hide the language they are written in by using some cumbersome pseudo-language which usually is almost Turing complete, but lacks tooling to debug and troubleshoot. Integrating with other systems is also usually quite hard as they usually have complex APIs if any at all. Some of the other common problems of those pseudo-languages is that are usually quite bad at dealing with data and re-usability is limited.
Nornir aims to solve those problems by providing a pure python framework. Just imagine Nornir as the Flask of automation. Nornir will take care of dealing with the inventory where you have your host information, it will take care of dispatching the tasks to your devices and will provide a common framework to write “plugins”.
Nornir requires Python 3.6.2 or higher to be installed.
How the documentation is structured¶
- The Tutorial is a great place to start for new users.
- How-to guides aim to solve a specific use case or answer key problems. These guides can be more advanced than the tutorial and can assume some knowledge about how Nornir and related technologies work.
- Reference guides contains the API reference for Nornir and describe the core functions.
- Configuration describe the configuration parameters of Nornir and their default settings.
- Plugins shows which tasks and functions are available out of the box with Nornir and describe how they work.
A first glance¶
Here is an example on how to quickly build a runbook leveraging Nornir to retrieve information from the network:
from nornir import InitNornir from nornir.plugins.functions.text import print_result from nornir.plugins.tasks.networking import napalm_get nr = InitNornir( config_file="nornir.yaml", dry_run=True ) results = nr.run( task=napalm_get, getters=["facts", "interfaces"] ) print_result(results)
You can find this and other examples here.