Skip to main content

No project description provided

Project description

PyPI version Python 3.6 Python 3.7 Python 3.8 Code Style

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


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-2021.7.30.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

nornir_ansible-2021.7.30-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file nornir_ansible-2021.7.30.tar.gz.

File metadata

  • Download URL: nornir_ansible-2021.7.30.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.11

File hashes

Hashes for nornir_ansible-2021.7.30.tar.gz
Algorithm Hash digest
SHA256 494cce0ac0b849d0247a3d99d23843d0005bc3b67af149c80c94406a73723dbc
MD5 56eeb8739dc11fbb2d845657f8850ee7
BLAKE2b-256 671c8cbde84fe935080abdba0b56faf8d1715f10f69f6c3864ddb6135ef5f7fc

See more details on using hashes here.

File details

Details for the file nornir_ansible-2021.7.30-py3-none-any.whl.

File metadata

  • Download URL: nornir_ansible-2021.7.30-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.11

File hashes

Hashes for nornir_ansible-2021.7.30-py3-none-any.whl
Algorithm Hash digest
SHA256 3d793f01dded13996ee4e51249f477f58b43e6496f5029836f149cb9a8bcfa81
MD5 b5636f29123e08873c7a446afb41457a
BLAKE2b-256 ab426a9410b23a3a538ba3019791ff14fdfc2f1b2461c01267a691bfd32c9228

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page