Nautobot

To create and manage device inventory via plugin, several steps are required. This guide covers the Nautobot plugin.

1

Install the plugin

There is an ansible-galaxy command that can install the plugin into the IAG server. You will likely have to incorporate this command into your IAG build plan so that you do not have to do this as a manual step. For Nautobot the command looks like this:

$ansible-galaxy collection install networktocode.nautobot==5.1.1
2

Configure Ansible to use the plugin

There are several ways to accomplish this step. Below is a suggested method for enabling a plugin. Make sure the interpreter_python is appropriate for the environment.

This example enables the Nautobot dynamic inventory plugin at /etc/ansible/ansible.cfg.

1[defaults]
2host_key_checking = False
3timeout = 900
4# This might need adjusting depending on specifics
5interpreter_python = /bin/python3.9
6INVENTORY_ENABLED = "networktocode.nautobot.inventory"
7
8[persistent_connection]
9command_timeout = 3600
10connect_timeout = 900
3

Configure the host file

Use the Nautobot Ansible documentation to determine the most appropriate way to configure the plugin to connect to and query from the source of truth system. The Nautobot plugin configuration below connects to the public Nautobot demo and returns all devices found there.

/opt/automation-gateway/ansible/inventory/hosts

1plugin: networktocode.nautobot.inventory
2# This is the public nautobot demo website.
3api_endpoint: https://demo.nautobot.com
4validate_certs: false
5config_context: true
6flatten_config_context: true
7flatten_local_context_data: true
8services: false
9plurals: false
10cache: true
11# Customer must determine how to apply appropriate filters
12#query_filters:
13# - role: switch
14# The silly token for the "demo" user on the nautobot demo site
15token: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
4

Confirm the plugin is working

Before invoking the plugin from IAG, the plugin should be tested directly from the command line using direct Ansible capability. This command will invoke the plugin and return the devices it finds.

$ansible-inventory -vvv --list -i <path-to-plugin-host-file>
5

Restart IAG

Restarting IAG should trigger the plugin to execute. Once execution finishes, you should see Nautobot devices in the Ansible inventory.