![](https://github.com/carlmontanari/nornir_ansible/workflows/Weekly%20Build/badge.svg)
[![PyPI version](https://badge.fury.io/py/nornir_ansible.svg)](https://badge.fury.io/py/nornir_ansible)
[![Python 3.6](https://img.shields.io/badge/python-3.6-blue.svg)](https://www.python.org/downloads/release/python-360/)
[![Python 3.7](https://img.shields.io/badge/python-3.7-blue.svg)](https://www.python.org/downloads/release/python-370/)
[![Python 3.8](https://img.shields.io/badge/python-3.8-blue.svg)](https://www.python.org/downloads/release/python-380/)
[![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
nornir ansible
==============
Ansible Inventory plugin for [nornir](https://github.com/nornir-automation/nornir).
# Install
In most cases installation via pip is the simplest and best way to install nornir_ansible.
```
pip install nornir_ansible
```
# Basic Example
In your nornir configuration, set the inventory plugin value to `AnsibleInventory`
```yaml
---
inventory:
plugin: AnsibleInventory
options:
hostsfile: "inventory.yaml"
```
The `hostsfile` inventory option argument should point to a valid Ansible inventory file, in this case a yaml style
inventory such as:
```yaml
---
all:
vars:
ansible_python_interpreter: "/usr/bin/python3"
username: "vrnetlab"
password: "VR-netlab9"
children:
sea:
hosts:
sea-eos-1:
ansible_host: "172.18.0.14"
sea-nxos-1:
ansible_host: "172.18.0.12"
children:
arista-eos:
hosts:
sea-eos-1:
vars:
platform: "eos"
cisco-nxos:
hosts:
sea-nxos-1:
vars:
platform: "nxos"
```
Initialize your nornir object and validate the appropriate inventory plugin was loaded, and the inventory file was
parsed:
```python
>>> from nornir import InitNornir
>>> nr = InitNornir(config_file="config.yaml")
>>> print(nr.config.inventory.plugin)
<class 'nornir_ansible.plugins.inventory.ansible.AnsibleInventory'>
>>> print(nr.inventory.hosts)
{'sea-eos-1': Host: sea-eos-1, 'sea-nxos-1': Host: sea-nxos-1}
>>>
```
# Useful Links
- [Nornir](https://github.com/nornir-automation/nornir)
- [Nornir Discourse Group](https://nornir.discourse.group)
- [Ansible Inventory Documentation](https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html)
- [An Introduction to Nornir Blog](https://pynet.twb-tech.com/blog/nornir/intro.html)
- [Nornir using an Ansible Inventory Blog](https://pynet.twb-tech.com/blog/nornir/nornir-ansible-inventory-p1.html)
Raw data
{
"_id": null,
"home_page": "https://github.com/carlmontanari/nornir_ansible",
"name": "nornir-ansible",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "",
"author": "Carl Montanari",
"author_email": "carl.r.montanari@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/37/a3/eb3d3a8d4f15e3cd4a618e622a7ebda8b44ffdddebf371326ecbf7a94943/nornir_ansible-2023.12.28.tar.gz",
"platform": null,
"description": "![](https://github.com/carlmontanari/nornir_ansible/workflows/Weekly%20Build/badge.svg)\n[![PyPI version](https://badge.fury.io/py/nornir_ansible.svg)](https://badge.fury.io/py/nornir_ansible)\n[![Python 3.6](https://img.shields.io/badge/python-3.6-blue.svg)](https://www.python.org/downloads/release/python-360/)\n[![Python 3.7](https://img.shields.io/badge/python-3.7-blue.svg)](https://www.python.org/downloads/release/python-370/)\n[![Python 3.8](https://img.shields.io/badge/python-3.8-blue.svg)](https://www.python.org/downloads/release/python-380/)\n[![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)\n\n\nnornir ansible\n==============\n\nAnsible Inventory plugin for [nornir](https://github.com/nornir-automation/nornir).\n\n\n# Install\n\nIn most cases installation via pip is the simplest and best way to install nornir_ansible.\n\n```\npip install nornir_ansible\n```\n\n\n# Basic Example\n\nIn your nornir configuration, set the inventory plugin value to `AnsibleInventory`\n\n```yaml\n---\ninventory:\n plugin: AnsibleInventory\n options:\n hostsfile: \"inventory.yaml\"\n```\n\nThe `hostsfile` inventory option argument should point to a valid Ansible inventory file, in this case a yaml style\n inventory such as:\n\n```yaml\n---\nall:\n vars:\n ansible_python_interpreter: \"/usr/bin/python3\"\n username: \"vrnetlab\"\n password: \"VR-netlab9\"\n children:\n sea:\n hosts:\n sea-eos-1:\n ansible_host: \"172.18.0.14\"\n sea-nxos-1:\n ansible_host: \"172.18.0.12\"\n children:\n arista-eos:\n hosts:\n sea-eos-1:\n vars:\n platform: \"eos\"\n cisco-nxos:\n hosts:\n sea-nxos-1:\n vars:\n platform: \"nxos\"\n```\n\nInitialize your nornir object and validate the appropriate inventory plugin was loaded, and the inventory file was\n parsed:\n\n```python\n>>> from nornir import InitNornir\n>>> nr = InitNornir(config_file=\"config.yaml\")\n>>> print(nr.config.inventory.plugin)\n<class 'nornir_ansible.plugins.inventory.ansible.AnsibleInventory'>\n>>> print(nr.inventory.hosts)\n{'sea-eos-1': Host: sea-eos-1, 'sea-nxos-1': Host: sea-nxos-1}\n>>>\n```\n\n# Useful Links\n\n- [Nornir](https://github.com/nornir-automation/nornir)\n- [Nornir Discourse Group](https://nornir.discourse.group)\n- [Ansible Inventory Documentation](https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html)\n- [An Introduction to Nornir Blog](https://pynet.twb-tech.com/blog/nornir/intro.html)\n- [Nornir using an Ansible Inventory Blog](https://pynet.twb-tech.com/blog/nornir/nornir-ansible-inventory-p1.html)\n",
"bugtrack_url": null,
"license": "",
"summary": "",
"version": "2023.12.28",
"project_urls": {
"Homepage": "https://github.com/carlmontanari/nornir_ansible"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3f8ec870d370c0b4d391f3aab2f6bf5242b0a636cea99764e5db56a7dfb2cf20",
"md5": "08741f43c302234b03603a4dc53b7a10",
"sha256": "1cc6b17880e66413607b953277a9659e1b98fcc7a5b767e6e1b7583b1244c031"
},
"downloads": -1,
"filename": "nornir_ansible-2023.12.28-py3-none-any.whl",
"has_sig": false,
"md5_digest": "08741f43c302234b03603a4dc53b7a10",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 12198,
"upload_time": "2023-12-28T16:39:13",
"upload_time_iso_8601": "2023-12-28T16:39:13.844329Z",
"url": "https://files.pythonhosted.org/packages/3f/8e/c870d370c0b4d391f3aab2f6bf5242b0a636cea99764e5db56a7dfb2cf20/nornir_ansible-2023.12.28-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "37a3eb3d3a8d4f15e3cd4a618e622a7ebda8b44ffdddebf371326ecbf7a94943",
"md5": "572e5e7ca984bdb2e2eb3566623d7fb5",
"sha256": "c04166b2a8584fcdcc592a010530757c64b414eacc98b15efae8c5ccf69a5230"
},
"downloads": -1,
"filename": "nornir_ansible-2023.12.28.tar.gz",
"has_sig": false,
"md5_digest": "572e5e7ca984bdb2e2eb3566623d7fb5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 12803,
"upload_time": "2023-12-28T16:39:15",
"upload_time_iso_8601": "2023-12-28T16:39:15.665692Z",
"url": "https://files.pythonhosted.org/packages/37/a3/eb3d3a8d4f15e3cd4a618e622a7ebda8b44ffdddebf371326ecbf7a94943/nornir_ansible-2023.12.28.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-28 16:39:15",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "carlmontanari",
"github_project": "nornir_ansible",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"tox": true,
"lcname": "nornir-ansible"
}