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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: nornir_ansible-2020.9.26.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

File hashes

Hashes for nornir_ansible-2020.9.26.tar.gz
Algorithm Hash digest
SHA256 39bb4ae2750762884db0a4fc9fb7c469911638fbee9471c46488a1e41f963ef1
MD5 e6576d3294d6bde108f4939e080dbfcd
BLAKE2b-256 012b116bbbe2e2989b47104e785af0911bd37a99e9b4a8c43ffbdeb781b4c896

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nornir_ansible-2020.9.26-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/47.1.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

File hashes

Hashes for nornir_ansible-2020.9.26-py3-none-any.whl
Algorithm Hash digest
SHA256 006d45ec4839ead7029deed650346ef721e2f82c3ab9ed767427946899e21bd4
MD5 065a4965d2847aa81496b14ec5a4604b
BLAKE2b-256 df25f5246605a76345a13af543f98d63b5016ef96269b6b9cf8d235ea1b14a70

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