# Ansible facts from command line - drill down

**URL:** <https://forum.ansible.com/t/ansible-facts-from-command-line-drill-down/25315>\
**Category:** Ansible Project\
**Created:** [August 23, 2017, 7:02pm UTC](https://forum.ansible.com/t/ansible-facts-from-command-line-drill-down/25315 "2017-08-23T19:02:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anfield](https://avatars.discourse-cdn.com/v4/letter/a/dec6dc/32.png) [@Anfield](https://forum.ansible.com/u/Anfield)\
**Post date:** [August 23, 2017, 7:02pm UTC](https://forum.ansible.com/t/ansible-facts-from-command-line-drill-down/25315/1 "2017-08-23T19:02:57Z")

</div>

Running this from command link - ansible all -m setup -a ‘filter=ansible\_default\_ipv4\*’

The output is

> 127.0.0.1 | SUCCESS =\> {
> 
> “ansible\_facts”: {
> 
> “ansible\_default\_ipv4”: {
> 
> “address”: “192.168.150.129”,
> 
> “alias”: “eno16777736”,
> 
> “broadcast”: “192.168.150.255”,
> 
> “gateway”: “192.168.150.2”,
> 
> “interface”: “eno16777736”,
> 
> “macaddress”: “00:0c:29:23:6d:31”,
> 
> “mtu”: 1500,
> 
> “netmask”: “255.255.255.0”,
> 
> “network”: “192.168.150.0”,
> 
> “type”: “ether”
> 
> }
> 
> },
> 
> “changed”: false
> 
> }

Trying to drill down to just display the address portion, and it is not displaying. ansible all -m setup -a ‘filter=ansible\_default\_ipv4\_address’ or ansible all -m setup -a ‘filter=ansible\_default\_ipv4.address’ does not display the address fact.

Do I have to do a grep on it or can I drill all the way down to address using the inbuilt ansible setup command? I know I can run this and it works → [ansible@localhost exercises]$ ansible all -m setup -a ‘filter=ansible\_default\_ipv4\*’ | grep address

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [August 23, 2017, 7:34pm UTC](https://forum.ansible.com/t/ansible-facts-from-command-line-drill-down/25315/2 "2017-08-23T19:34:44Z")

</div>

The filter functionality only works for top level keys. You can either grep, or use the `--tree` option to write the response out to a file, and then use something like jq or a programming language to parse the JSON file.
