Capture ethernet device of given ip address

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.

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