nornir_cli
Documentation: https://timeforplanb123.github.io/nornir_cli
nornir_cli is CLI tool based on Nornir framework, Nornir Plugins and Click
Features
-
Simple CLI network orchestrator
nornir_cliis a simple CLI orchestrator, that you can use to interact with the SoT and manage your network -
Workflow
nornir_cliworkflow isNornirworkflow, but from CLI -
Manage your custom nornir runbooks
- Create and manage your own nornir runbook collections:
- Add your custom nornir runbooks as custom commands in
nornir_cliwithrunbook collectionsfeature - Pass any python objects between custom commands
- Run custom commands for any hosts directly from the CLI
- Add your custom nornir runbooks as custom commands in
- Or use
nornir_clifor inventory management only, and take the result in your nornir runbooks. By excluding getting and filtering the inventory in your runbooks, you will make them more versatile.
- Create and manage your own nornir runbook collections:
-
Manage Inventory
Get Inventory, filter Inventory, output Inventory and save Inventory state from the CLI for any inventory plugin. This is really useful for large, structured Inventory - for example, NetBox with nornir_netbox plugin.
You can use nornir_netbox or SimpleInventory, by default. Another inventory plugin needs to be installed from here with
pip. -
Run Nornir Plugins
nornir_clialready has commands, based on Nornir Plugins. Run them from the CLI, check result and statistic -
Build a chain of
nornir_clicommandsInitialize Nornir, filter Inventory and run any command/command chains as one command
-
Json input. Json output
Json strings are everywhere! Command options and arguments accept json strings. Use this feature in your scripts with the
jq,jcutilities -
Custom Multi Commands with click
nornir_clibased on click Custom Multi Commands, so you can easily add your custom command by following some principles
Quick Start
Install
Please, at first, check the dependencies in pyproject.toml and create new virtual environment if necessary and then:
with pip:
pip install nornir_cli
with git:
git clone https://github.com/timeforplanb123/nornir_cli.git
cd nornir_cli
pip install .
# or
poetry install
with Docker:
git clone https://github.com/timeforplanb123/nornir_cli.git
cd nornir_cli
docker build -t timeforplanb123/nornir_cli .
docker run --rm -it timeforplanb123/nornir_cli sh
# nornir_cli --version
nornir_cli, version 1.2.0
Simple Example
config.yaml
# Simple Nornir configuration file
inventory:
plugin: SimpleInventory
options:
host_file: "inventory/hosts.yaml"
hosts.yaml
# Single host inventory
dev_1:
hostname: 10.1.0.1
username: username
password: password
# huawei is just an example here
platform: huawei
nornir_cli
# As instance, let's run netmiko_send_command
$ nornir_cli nornir-netmiko init netmiko_send_command --command_string "display clock"
netmiko_send_command************************************************************
* dev_1 ** changed : False *****************************************************
vvvv netmiko_send_command ** changed : False vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv INFO
2021-03-17 14:04:22+03:00
Wednesday
Time Zone(Moscow) : UTC+03:00
^^^^ END netmiko_send_command ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
dev_1 : ok=1 changed=0 failed=0
OK : 1
CHANGED : 0
FAILED : 0
Metadata
Release files for nornir-cli 1.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nornir_cli-1.3.0.tar.gz | 20.5 kB | Without provenance | Details for nornir_cli-1.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nornir_cli-1.3.0-py3-none-any.whl | Python 3 | none | any | Details for nornir_cli-1.3.0-py3-none-any.whl |
Total release size: 50.4 kB
Release files / nornir_cli-1.3.0.tar.gz
| Download URL | nornir_cli-1.3.0.tar.gz |
|---|---|
| Size | 20.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2d048fd227b1a93058d09f4d7b74abf88d9d9acd0a23eb23de94b9cb4f24ab0d
|
|
BLAKE2b-256 checksum How to use checksums |
9fa6962ee87d0a8e36ec4217f860d4c5223c6fff7c80a030fbe0cc2274a23a45
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|
Release files / nornir_cli-1.3.0-py3-none-any.whl
| Download URL | nornir_cli-1.3.0-py3-none-any.whl |
|---|---|
| Size | 29.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
56b6da0b9b76b7e22f6621a914730b4598ae966dd24a30eccb26802527b26d32
|
|
BLAKE2b-256 checksum How to use checksums |
f3ef7026c268b31e6338e3724f01b416f43a4dc3c767a97d0cb6ba7190b76119
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|
Security for nornir-cli 1.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.