# Capture ethernet device of given ip address

**URL:** <https://forum.ansible.com/t/capture-ethernet-device-of-given-ip-address/23329>\
**Category:** Ansible Project\
**Tags:** vmware\
**Created:** [December 23, 2016, 3:22pm UTC](https://forum.ansible.com/t/capture-ethernet-device-of-given-ip-address/23329 "2016-12-23T15:22:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Neil\_Watson](https://avatars.discourse-cdn.com/v4/letter/n/dbc845/32.png) [@Neil\_Watson](https://forum.ansible.com/u/Neil_Watson)\
**Post date:** [December 23, 2016, 3:22pm UTC](https://forum.ansible.com/t/capture-ethernet-device-of-given-ip-address/23329/1 "2016-12-23T15:22:06Z")

</div>

Greetings,

I know the IP address of a host. How do I filter at setup task to get the device the address is assigned to? End goal is after creating a new vmware image, I know the temporary IP, want to assign a permanent one, but need to know the device name.

I can get the whole lot with

setup:  
register: host\_info

But filtering in Ansible is not something I’m familiar with.

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [December 23, 2016, 8:34pm UTC](https://forum.ansible.com/t/capture-ethernet-device-of-given-ip-address/23329/2 "2016-12-23T20:34:11Z")

</div>

As far is I know, filter only works on key not value, so you can't use filer for this.  
You'll need to loop over all the interfaces and check the IP to find the correct one.

But you might be able to use ansible\_default\_ipv4.interface
