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.7.30.tar.gz
(12.5 kB
view details)
Built Distribution
File details
Details for the file nornir_ansible-2022.7.30.tar.gz
.
File metadata
- Download URL: nornir_ansible-2022.7.30.tar.gz
- Upload date:
- Size: 12.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2921fc0a03e2c05d32c976bd23c722742fdc8613fb6e0c2c0965486e219f1be0 |
|
MD5 | 06b86b28d3243b85160b93d7ed3fd1b0 |
|
BLAKE2b-256 | 91df2bd59501e65e5c5ecfb60b9a73c991a99320c72abaf3b7547e3c3b832c39 |
File details
Details for the file nornir_ansible-2022.7.30-py3-none-any.whl
.
File metadata
- Download URL: nornir_ansible-2022.7.30-py3-none-any.whl
- Upload date:
- Size: 12.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f72839c44133e578ce4dc53b9a1158d4571e46f25350132f6e15ce24bd112c47 |
|
MD5 | 72e8d24bf0b3c14faeebc81794634e79 |
|
BLAKE2b-256 | 5b6baad007a261da0051fbc0187ccd365ff54b4dad14ecbc7df3fa9a95172f7e |