# Vmware\_vm\_inventory : Select a specific IP address for use by ansible

**URL:** <https://forum.ansible.com/t/vmware-vm-inventory-select-a-specific-ip-address-for-use-by-ansible/10397>\
**Category:** Get Help\
**Tags:** vmware, plugin, inventory\
**Created:** [October 18, 2024, 2:37pm UTC](https://forum.ansible.com/t/vmware-vm-inventory-select-a-specific-ip-address-for-use-by-ansible/10397 "2024-10-18T14:37:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![romgo](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/romgo/32/5202_2.png) [@romgo](https://forum.ansible.com/u/romgo)\
**Post date:** [October 18, 2024, 2:37pm UTC](https://forum.ansible.com/t/vmware-vm-inventory-select-a-specific-ip-address-for-use-by-ansible/10397/1 "2024-10-18T14:37:42Z")

</div>

Hello,

I am trying to use vmware\_vm\_inventory plugin, this is working but in my environment I need to select a specific IP for ansible inventory. Indeed my VM has several IPs, only one can be used by ansible.

Hopefully there is an exemple in the documentation for this particular need 🙂  
[https://docs.ansible.com/ansible/latest/collections/community/vmware/vmware\_vm\_inventory\_inventory.html#examples](https://docs.ansible.com/ansible/latest/collections/community/vmware/vmware_vm_inventory_inventory.html#examples)

Here is my config :

```auto
plugin: vmware_vm_inventory
strict: False
hostname: vcsa.domain.local
username: administrator@vsphere.local
password: PASSWORD
validate_certs: False
with_tags: False
hostnames:
    - 'guest.hostName'
    - 'config.name'
groups:
  VMs: True
compose:
      # Set the IP address used by ansible to one that starts by 10.207. 
      ansible_host: >-
        guest.net
        | selectattr('ipAddress')
        | map(attribute='ipAddress')
        | flatten
        | select('match', '^10.207.*')
        | list
        | first
      properties:
        - guest.net

```

The issue is that the test VM return the following

```auto
{
    "config.cpuHotAddEnabled": false,
    "config.cpuHotRemoveEnabled": false,
    "config.guestId": "debian9_64Guest",
    "config.hardware.numCPU": 2,
    "config.instanceUuid": "50211c6c-6947-555-dade0e-56c3a1adc846",
    "config.name": "glpi",
    "config.template": false,
    "config.uuid": "42471-8c7c-a6e8-b360-f021f533b782",
    "guest.guestId": "debian9_64Guest",
    "guest.guestState": "running",
    "guest.hostName": "glpi",
    "guest.ipAddress": "10.206.200.56",
    "name": "glpi",
    "properties": [
        "guest.net"
    ],
    "runtime.connectionState": "connected",
    "runtime.maxMemoryUsage": 2048,
    "summary.runtime.powerState": "poweredOn"
}

```

guest.ipAddress still return 10.206 interface instead of 10.207. interface IP.  
Is there any way to debug this “compose” section ?

thank you for your help
