No project description provided
Project description
nornir ansible
Ansible Inventory plugin for 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
---
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:
---
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:
>>> 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nornir_ansible-2022.1.30.tar.gz
(12.4 kB
view details)
Built Distribution
File details
Details for the file nornir_ansible-2022.1.30.tar.gz
.
File metadata
- Download URL: nornir_ansible-2022.1.30.tar.gz
- Upload date:
- Size: 12.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8c95d51107608b3e6b1cd0cda015515762f8c90917307cd3c9df7188f3df2dd |
|
MD5 | ce4f6c23a9f46ea7989dd07f2e95fc09 |
|
BLAKE2b-256 | cb1790cc5d250d0707863e146cbd9003a2cfd35535ad0d16010a35f3b1a31f0c |
File details
Details for the file nornir_ansible-2022.1.30-py3-none-any.whl
.
File metadata
- Download URL: nornir_ansible-2022.1.30-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b8cd685296e51bb162ab498c5280e1bf0a67d0db453ff98b4c5c4be35e8b2ed1 |
|
MD5 | 9299082266c1b19f25deda38de160ccc |
|
BLAKE2b-256 | d556053474ac521f8d13aa3b930d51f249e6ec52d12fd5863852dbb8ae2f6564 |