{"library":"nornir","title":"Nornir","description":"Nornir is a pluggable multi-threaded automation framework with inventory management for operating collections of network devices. It provides a pure Python approach to network automation without relying on a DSL. Current version is 3.5.0 (2024-09-16), released several times a year.","language":"python","status":"active","last_verified":"Fri May 01","install":{"commands":["pip install nornir","pip install nornir[paramiko]"],"cli":{"name":"nornir","version":"sh: 1: nornir: not found"}},"imports":["from nornir import InitNornir","from nornir.plugins.functions import NRF","from nornir.core.filter import F"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from nornir import InitNornir\nfrom nornir.core.task import Task, Result\n\n# Create a simple inventory definition inline\nnr = InitNornir(\n    inventory={\n        \"plugin\": \"DictInventory\",\n        \"options\": {\n            \"hosts\": {\n                \"router1\": {\n                    \"hostname\": \"192.0.2.1\",\n                    \"username\": \"admin\",\n                    \"password\": \"password\"\n                }\n            }\n        }\n    }\n)\n\n# Define a task\ndef hello_task(task: Task) -> Result:\n    return Result(host=task.host, result=f\"Hello from {task.host.name}\")\n\n# Run the task\nresults = nr.run(task=hello_task)\nprint(results['router1'][0].result)\n\n# Close connections if any\nnr.close_connections()","lang":"python","description":"Basic example: initialize Nornir with an inline dict inventory, run a simple task, and print the result.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}