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

Uploaded Source

Built Distribution

nornir_ansible-2020.7.20-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nornir_ansible-2020.7.20.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3

File hashes

Hashes for nornir_ansible-2020.7.20.tar.gz
Algorithm Hash digest
SHA256 347254dbfa9d80a98ce476eedccf5d020ac166820d58eccba9aa680cb741cb2a
MD5 f64c1a83c992b6e2451e5668b6f759ac
BLAKE2b-256 5e971ec8055d0cf27d9a41c952b6363371b62d754bdd3a4db0794539ceb86637

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nornir_ansible-2020.7.20-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3

File hashes

Hashes for nornir_ansible-2020.7.20-py3-none-any.whl
Algorithm Hash digest
SHA256 3a36ca5aab760d99972091f41482fb47af381d8fc9016c3d3d542f0ffbb6697d
MD5 18addb6d16ac05fcb7295058b1789d38
BLAKE2b-256 1ac8dfa4c61f7100905636b56dd68fcd0dbc7d6d0d57cbd176befc134577167c

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