Added config-context in hostvars (#47394)

* Added config-contexts in hostvars

* Changed config-contexts to config-context in hostvars
pull/48580/head
nikkytub 6 years ago committed by ansibot
parent a8b5d30a9e
commit f3583cebd6

@ -198,6 +198,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
"device_roles": self.extract_device_role,
"platforms": self.extract_platform,
"device_types": self.extract_device_type,
"config_context": self.extract_config_context,
"manufacturers": self.extract_manufacturer
}
@ -246,6 +247,14 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
except Exception:
return
def extract_config_context(self, host):
try:
url = urljoin(self.api_endpoint, "/api/dcim/devices/" + str(host["id"]))
device_lookup = self._fetch_information(url)
return [device_lookup["config_context"]]
except Exception:
return
def extract_manufacturer(self, host):
try:
return [self.manufacturers_lookup[host["device_type"]["manufacturer"]["id"]]]

Loading…
Cancel
Save