Skip to content

Commit 589e211

Browse files
Inventory: Extract custom fields as host_vars (#159)
1 parent fdf247e commit 589e211

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

plugins/inventory/nb_inventory.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ def group_extractors(self):
300300
"config_context": self.extract_config_context,
301301
"manufacturers": self.extract_manufacturer,
302302
"interfaces": self.extract_interfaces,
303+
"custom_fields": self.extract_custom_fields,
303304
}
304305

305306
def extract_disk(self, host):
@@ -455,6 +456,12 @@ def extract_interfaces(self, host):
455456
except Exception:
456457
return
457458

459+
def extract_custom_fields(self, host):
460+
try:
461+
return host["custom_fields"]
462+
except Exception:
463+
return
464+
458465
def refresh_platforms_lookup(self):
459466
url = self.api_endpoint + "/api/dcim/platforms/?limit=0"
460467
platforms = self.get_resource_list(api_url=url)

0 commit comments

Comments
 (0)