[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
[![PyPI](https://img.shields.io/pypi/v/nornir-cli.svg)](https://pypi.org/project/nornir-cli)
[![License: MIT](https://img.shields.io/badge/License-MIT-blueviolet.svg)](https://opensource.org/licenses/MIT)
[![Docs](https://img.shields.io/badge/docs-passing-green.svg)](https://timeforplanb123.github.io/nornir_cli/)
nornir_cli
==========
---
**Documentation**: <a href="https://timeforplanb123.github.io/nornir_cli" target="_blank">https://timeforplanb123.github.io/nornir_cli</a>
---
**nornir_cli** is CLI tool based on <a href="https://github.com/nornir-automation/nornir" target="_blank">Nornir framework</a>,
<a href="https://nornir.tech/nornir/plugins/" target="_blank">Nornir Plugins</a> and <a href="https://github.com/pallets/click" target="_blank">Click</a>
## Features
* **Simple CLI network orchestrator**
`nornir_cli` is a simple CLI orchestrator, that you can use to interact with the SoT and manage your network
* **Workflow**
`nornir_cli` workflow is `Nornir` workflow, 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_cli` with `runbook collections` feature
* Pass any python objects between custom commands
* Run custom commands for any hosts directly from the CLI
* Or use `nornir_cli` for 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.
* **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, <a href="https://github.com/netbox-community/netbox" target="_blank">NetBox</a> with <a href="https://github.com/wvandeun/nornir_netbox" target="_blank">nornir_netbox plugin</a>.
You can use <a href="https://github.com/wvandeun/nornir_netbox" target="_blank">nornir_netbox</a> or SimpleInventory, by default. Another inventory plugin needs to be installed from <a href="https://nornir.tech/nornir/plugins/" target="_blank">here</a> with `pip`.
* **Run Nornir Plugins**
`nornir_cli` already has commands, based on Nornir Plugins. Run them from the CLI, check result and statistic
* **Build a chain of `nornir_cli` commands**
Initialize 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`, `jc` utilities
* **Custom Multi Commands with click**
`nornir_cli` based 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:**
```text
pip install nornir_cli
```
**with git:**
```text
git clone https://github.com/timeforplanb123/nornir_cli.git
cd nornir_cli
pip install .
# or
poetry install
```
**with Docker:**
```text
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
```yaml
# Simple Nornir configuration file
inventory:
plugin: SimpleInventory
options:
host_file: "inventory/hosts.yaml"
```
#### hosts.yaml
```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
```text
# 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
```
Raw data
{
"_id": null,
"home_page": "https://github.com/timeforplanb123/nornir_cli",
"name": "nornir-cli",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<4.0.0",
"maintainer_email": "",
"keywords": "nornir,click,nornir cli,nornir-plugin",
"author": "Pavel Shemetov",
"author_email": "timeforplanb123@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/9f/a6/962ee87d0a8e36ec4217f860d4c5223c6fff7c80a030fbe0cc2274a23a45/nornir_cli-1.3.0.tar.gz",
"platform": null,
"description": "[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)\n[![PyPI](https://img.shields.io/pypi/v/nornir-cli.svg)](https://pypi.org/project/nornir-cli)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blueviolet.svg)](https://opensource.org/licenses/MIT)\n[![Docs](https://img.shields.io/badge/docs-passing-green.svg)](https://timeforplanb123.github.io/nornir_cli/)\n\nnornir_cli\n==========\n\n---\n\n**Documentation**: <a href=\"https://timeforplanb123.github.io/nornir_cli\" target=\"_blank\">https://timeforplanb123.github.io/nornir_cli</a>\n\n---\n\n**nornir_cli** is CLI tool based on <a href=\"https://github.com/nornir-automation/nornir\" target=\"_blank\">Nornir framework</a>,\n<a href=\"https://nornir.tech/nornir/plugins/\" target=\"_blank\">Nornir Plugins</a> and <a href=\"https://github.com/pallets/click\" target=\"_blank\">Click</a>\n\n\n## Features \n\n* **Simple CLI network orchestrator**\n\n `nornir_cli` is a simple CLI orchestrator, that you can use to interact with the SoT and manage your network\n\n* **Workflow**\n\n `nornir_cli` workflow is `Nornir` workflow, but from CLI\n\n* **Manage your custom nornir runbooks**\n\n * Create and manage your own nornir runbook collections: \n * Add your custom nornir runbooks as custom commands in `nornir_cli` with `runbook collections` feature\n * Pass any python objects between custom commands \n * Run custom commands for any hosts directly from the CLI\n * Or use `nornir_cli` for 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.\n\n* **Manage Inventory**\n\n Get Inventory, filter Inventory, output Inventory and save Inventory state from the CLI for any inventory plugin.\n This is really useful for large, structured Inventory - for example, <a href=\"https://github.com/netbox-community/netbox\" target=\"_blank\">NetBox</a> with <a href=\"https://github.com/wvandeun/nornir_netbox\" target=\"_blank\">nornir_netbox plugin</a>.\n\n You can use <a href=\"https://github.com/wvandeun/nornir_netbox\" target=\"_blank\">nornir_netbox</a> or SimpleInventory, by default. Another inventory plugin needs to be installed from <a href=\"https://nornir.tech/nornir/plugins/\" target=\"_blank\">here</a> with `pip`. \n\n* **Run Nornir Plugins**\n\n `nornir_cli` already has commands, based on Nornir Plugins. Run them from the CLI, check result and statistic\n\n* **Build a chain of `nornir_cli` commands**\n\n Initialize Nornir, filter Inventory and run any command/command chains as one command\n\n* **Json input. Json output**\n\n Json strings are everywhere! Command options and arguments accept json strings. Use this feature in your scripts with the `jq`, `jc` utilities\n\n* **Custom Multi Commands with click**\n\n `nornir_cli` based on click Custom Multi Commands, so you can easily add your custom command by following some principles\n\n\n## Quick Start \n\n#### Install\n\nPlease, at first, check the dependencies in `pyproject.toml` and create new virtual environment if necessary and then:\n\n**with pip:**\n\n```text\npip install nornir_cli\n```\n\n**with git:**\n\n```text\ngit clone https://github.com/timeforplanb123/nornir_cli.git\ncd nornir_cli\npip install .\n# or\npoetry install\n```\n\n**with Docker:**\n\n```text\ngit clone https://github.com/timeforplanb123/nornir_cli.git\ncd nornir_cli\ndocker build -t timeforplanb123/nornir_cli .\ndocker run --rm -it timeforplanb123/nornir_cli sh\n\n# nornir_cli --version\nnornir_cli, version 1.2.0\n```\n\n#### Simple Example\n\n\n#### config.yaml\n```yaml\n# Simple Nornir configuration file\ninventory:\n plugin: SimpleInventory\n options:\n host_file: \"inventory/hosts.yaml\"\n```\n#### hosts.yaml\n```yaml\n# Single host inventory\ndev_1:\n hostname: 10.1.0.1\n username: username \n password: password\n # huawei is just an example here\n platform: huawei\n```\n#### nornir_cli\n```text\n# As instance, let's run netmiko_send_command\n\n$ nornir_cli nornir-netmiko init netmiko_send_command --command_string \"display clock\"\n\nnetmiko_send_command************************************************************\n* dev_1 ** changed : False *****************************************************\nvvvv netmiko_send_command ** changed : False vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv INFO\n2021-03-17 14:04:22+03:00\nWednesday\nTime Zone(Moscow) : UTC+03:00\n^^^^ END netmiko_send_command ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\ndev_1 : ok=1 changed=0 failed=0\n\nOK : 1\nCHANGED : 0\nFAILED : 0\n```\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Nornir CLI",
"version": "1.3.0",
"project_urls": {
"Documentation": "https://timeforplanb123.github.io/nornir_cli/",
"Homepage": "https://github.com/timeforplanb123/nornir_cli",
"Repository": "https://github.com/timeforplanb123/nornir_cli"
},
"split_keywords": [
"nornir",
"click",
"nornir cli",
"nornir-plugin"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f3ef7026c268b31e6338e3724f01b416f43a4dc3c767a97d0cb6ba7190b76119",
"md5": "422d9816831c172731866db15b1dd369",
"sha256": "56b6da0b9b76b7e22f6621a914730b4598ae966dd24a30eccb26802527b26d32"
},
"downloads": -1,
"filename": "nornir_cli-1.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "422d9816831c172731866db15b1dd369",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0.0",
"size": 29844,
"upload_time": "2023-12-11T07:36:10",
"upload_time_iso_8601": "2023-12-11T07:36:10.374033Z",
"url": "https://files.pythonhosted.org/packages/f3/ef/7026c268b31e6338e3724f01b416f43a4dc3c767a97d0cb6ba7190b76119/nornir_cli-1.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9fa6962ee87d0a8e36ec4217f860d4c5223c6fff7c80a030fbe0cc2274a23a45",
"md5": "78cd2e5b7a5dd62acb0337a21605cce5",
"sha256": "2d048fd227b1a93058d09f4d7b74abf88d9d9acd0a23eb23de94b9cb4f24ab0d"
},
"downloads": -1,
"filename": "nornir_cli-1.3.0.tar.gz",
"has_sig": false,
"md5_digest": "78cd2e5b7a5dd62acb0337a21605cce5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0.0",
"size": 20525,
"upload_time": "2023-12-11T07:36:11",
"upload_time_iso_8601": "2023-12-11T07:36:11.979952Z",
"url": "https://files.pythonhosted.org/packages/9f/a6/962ee87d0a8e36ec4217f860d4c5223c6fff7c80a030fbe0cc2274a23a45/nornir_cli-1.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-11 07:36:11",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "timeforplanb123",
"github_project": "nornir_cli",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "nornir-cli"
}