diff --git a/plugins/inventory/nb_inventory.py b/plugins/inventory/nb_inventory.py index aa441e3ca..ca41877d4 100644 --- a/plugins/inventory/nb_inventory.py +++ b/plugins/inventory/nb_inventory.py @@ -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 = """ @@ -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. @@ -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")