# Get network name as group while sync vcenter inventory

**URL:** <https://forum.ansible.com/t/get-network-name-as-group-while-sync-vcenter-inventory/35879>\
**Category:** AWX Project\
**Created:** [October 15, 2021, 9:56am UTC](https://forum.ansible.com/t/get-network-name-as-group-while-sync-vcenter-inventory/35879 "2021-10-15T09:56:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Louise\_Elie](https://avatars.discourse-cdn.com/v4/letter/l/eb8c5e/32.png) [@Louise\_Elie](https://forum.ansible.com/u/Louise_Elie)\
**Post date:** [October 15, 2021, 9:56am UTC](https://forum.ansible.com/t/get-network-name-as-group-while-sync-vcenter-inventory/35879/1 "2021-10-15T09:56:45Z")

</div>

Hello !

I would like to add hosts in a group according to the network name.

I modified the vmware\_vm\_incentory.py file to add [guest.net](http://guest.net) as properties.  
Problem is, I’m having trouble adding only a specific variable from [guest.net](http://guest.net) for key\_groups.

[Guest.net](http://Guest.net) returns these variables in the host:  
_[guest.net](http://guest.net):_  
_- connected: true_  
_deviceConfigId: xxxx_  
_dnsConfig: null_  
_ipAddress:_  
_- xxx.xx.xxx.xx_  
_- ‘xxxx :: xxx: xxxx: xxxx: xxx’_  
_ipConfig:_  
_autoConfigurationEnabled: null_  
_dhcp: null_  
_ipAddress:_  
_- ipAddress: xxx.xx.xxx.xx_  
_lifetime: null_  
_origin: null_  
_prefixLength: 22_  
_state: preferred_  
_- ipAddress: ‘xxxx :: xxx: xxxx: xxxx: xxx’_  
_lifetime: null_  
_origin: null_  
_prefixLength: 64_  
_state: unknown_  
_macAddress: ‘xx: xx: xx: xx: xx: xx’_  
_netBIOSConfig: null_  
_ **network** : production_

I want to retrieve only the “network” parameter of the [guest.net](http://guest.net) as a group variable.

(vmware\_vm\_incentory.py file)  
keyed\_groups:  
description:

- Add hosts to group based on the values ​​of a variable.  
type: list  
default: [  
{key: ‘guest.guestId’, separator: ‘’},  
{key: ‘summary.runtime.powerState’, separator: ‘’},  
{ **key: ‘guest.net.network’, separator: ‘’}, ??**  
]

Do you know what syntax to use to retrieve the network parameter of the [guest.net](http://guest.net) property to add hosts to a group following the network name?

Thank you in advance.

Louise
