Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions plugins/inventory/nb_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@
type: boolean
default: True
version_added: "3.6.0"
headers:
description: Dictionary of headers to be passed to the NetBox API.
type: dict
default: {}
"""

EXAMPLES = """
Expand All @@ -249,6 +253,8 @@
device_query_filters:
- has_primary_ip: 'true'
- tenant__n: internal
headers:
Cookie: "{{ auth_cookie }}"

# has_primary_ip is a useful way to filter out patch panels and other passive devices
# Adding '__n' to a field searches for the negation of the value.
Expand Down Expand Up @@ -1980,6 +1986,7 @@ def parse(self, inventory, loader, path, cache=True):
"User-Agent": "ansible %s Python %s"
% (ansible_version, python_version.split(" ", maxsplit=1)[0]),
"Content-type": "application/json",
**self.get_option("headers"),
}
self.cert = self.get_option("cert")
self.key = self.get_option("key")
Expand Down