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-2023.12.28.tar.gz
(12.8 kB
view details)
Built Distribution
File details
Details for the file nornir_ansible-2023.12.28.tar.gz
.
File metadata
- Download URL: nornir_ansible-2023.12.28.tar.gz
- Upload date:
- Size: 12.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c04166b2a8584fcdcc592a010530757c64b414eacc98b15efae8c5ccf69a5230 |
|
MD5 | 572e5e7ca984bdb2e2eb3566623d7fb5 |
|
BLAKE2b-256 | 37a3eb3d3a8d4f15e3cd4a618e622a7ebda8b44ffdddebf371326ecbf7a94943 |
File details
Details for the file nornir_ansible-2023.12.28-py3-none-any.whl
.
File metadata
- Download URL: nornir_ansible-2023.12.28-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1cc6b17880e66413607b953277a9659e1b98fcc7a5b767e6e1b7583b1244c031 |
|
MD5 | 08741f43c302234b03603a4dc53b7a10 |
|
BLAKE2b-256 | 3f8ec870d370c0b4d391f3aab2f6bf5242b0a636cea99764e5db56a7dfb2cf20 |