mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
netbox: inventory: Fix VMs do not have device_roles, but instead use roles (#50761)
This makes sure that roles show up as device_role when using VMs
This commit is contained in:
parent
7b84c0ee80
commit
e6ae688e47
1 changed files with 4 additions and 1 deletions
|
@ -252,7 +252,10 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
|
||||||
|
|
||||||
def extract_device_role(self, host):
|
def extract_device_role(self, host):
|
||||||
try:
|
try:
|
||||||
|
if 'device_role' in host:
|
||||||
return [self.device_roles_lookup[host["device_role"]["id"]]]
|
return [self.device_roles_lookup[host["device_role"]["id"]]]
|
||||||
|
elif 'role' in host:
|
||||||
|
return [self.device_roles_lookup[host["role"]["id"]]]
|
||||||
except Exception:
|
except Exception:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue