Setup module to retrieve only ipv4

Hi, I am trying the following

ansible localhost -m ansible.builtin.setup -a 'filter=ansible_facts.ansible_eth0.ipv4.address'

also
ansible localhost -m ansible.builtin.setup -a 'filter=ansible_eth0.ipv4.address'
also
ansible localhost -m ansible.builtin.setup -a 'filter=ipv4.address'

but noting is returned as follows:

localhost | SUCCESS => {
    "ansible_facts": {},
    "changed": false
}

am I missing something?
When I check the full yaml for ansible_facts and parse it with

when I use

Setup module filter works only for top level elements.

So closest you could get is:

ansible localhost -m ansible.builtin.setup -a 'filter=ansible_eth0'

If you want more consice output, consider using ip utility with shell module

ansible localhost -m shell -a "ip -f inet addr show eth0 | sed -En -e 's/.*inet ([0-9.]+).*/\1/p'"

Wow this is not very easy to figure out :slight_smile: