Skip to content

Commit c2d2cd3

Browse files
authored
Allow netbox api access token to be templated (#806)
Allow jinja-templating of the api access token. This makes it possible to use a lookup() to retrieve the token, i.e. from a password-manager. Idea is stolen from the hcloud inventory.
1 parent 034cfe6 commit c2d2cd3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

plugins/inventory/nb_inventory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1853,7 +1853,7 @@ def parse(self, inventory, loader, path, cache=True):
18531853
self.use_cache = cache
18541854

18551855
# NetBox access
1856-
token = self.get_option("token")
1856+
token = self.templar.template(self.get_option("token"), fail_on_undefined=False)
18571857
# Handle extra "/" from api_endpoint configuration and trim if necessary, see PR#49943
18581858
self.api_endpoint = self.get_option("api_endpoint").strip("/")
18591859
self.timeout = self.get_option("timeout")

0 commit comments

Comments
 (0)