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.
On Wed, Aug 23, 2017 at 2:02 PM, Anfield <[email protected]> wrote: > 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 > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/ansible-project/ecebca32-cfd6-4579-a49f-1438774352fa%40googlegroups. > com > <https://groups.google.com/d/msgid/ansible-project/ecebca32-cfd6-4579-a49f-1438774352fa%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Matt Martz @sivel sivel.net -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAD8N0v9CpehaA_s7nsWaEEA5FnDeaSN68Yt4kbXJAnbxmeVL-A%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
