question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add config-context option to Netbox Inventory Plugin

See original GitHub issue

There was a new feature added in Netbox v2.4 called Config context which allows additional variables to be tied to devices. This does require an additional call per device to obtain the config_context for each device due to requiring the device ID.

The API endpoint is found at http://netbox-url/api/dcim/devices/<id>/

I’m just looking for a quick discussion on where we should set the option and the default value.

Should we add it as a positional argument or just have it part of the **kwargs? And I’m thinking the default value should be set to false if we go the positional argument method as it can be a massive speed sink if there are thousands of devices within someone’s Netbox inventory (we’re seeing this behavior on the Ansible Netbox dynamic inventory).

My vote would be on the positional argument method so that it’s clearly documented as an option, but wanted to get some feedback before I submit the PR to implement this.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
FragmentedPacketcommented, May 12, 2019

@wvandeun Thanks for that! That’s why there hasn’t been a PR opened. I will have to add the option disable it within the inventory which I should be able to get to soon as it may cause performance issues moving forward with fetching large inventories.

1reaction
wvandeuncommented, May 10, 2019

Not sure if you have put any effort into this already, but it looks like from v2.6 (now in beta) config-context will be included by default for all API results. A parameter is added to exclude config-context if you don’t want it (or if the query becomes to slow).

https://github.com/digitalocean/netbox/commit/bd573fd5cf3273456d1ac5faabbde85509cb8387

Read more comments on GitHub >

github_iconTop Results From Across the Web

netbox.netbox.nb_inventory inventory – NetBox inventory source
This inventory plugin is part of the netbox.netbox collection (version 3.10.0). ... the config context variables will be added directly to the host...
Read more >
NetBox inventory source - Ansible Documentation
Parameter Choices/Defaults Configuration api_endpoint. ‑ / required env:NETBOX_API compose. dictionary Default: config_context. boolean Default: "no"
Read more >
NetBox Ansible Collection: Inventory - Starting Out - Josh-V
The plugin will gather information from NetBox and from the data create groups and an inventory for use by Ansible.
Read more >
Ansible Dynamic Inventory Using Plugins | The NTC Mag
NetBox allows for the definition of variables, which can be associated with hosts. You can add variables to a host by navigating to...
Read more >
Golden Configuration Deployment with Ansible and Netbox
Populate Source of Truth (Netbox) with desired configuration context to be loaded as dynamic inventory host variables.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found