Ansible filter using ad-hoc command
You can't. As the documentation for setup
says, "The filter option filters only the first level subkey below ansible_facts."
this is a bit messy, but you can..
I am running my ansible against my localhost, so you will have to modify the path a bit, and replace localhost
ANSIBLE_LOAD_CALLBACK_PLUGINS=true ANSIBLE_STDOUT_CALLBACK=json ansible localhost -m setup | jq .plays[].tasks[].hosts.localhost.ansible_facts.ansible_memory_mb.nocache
output:
{
"free": 11987,
"used": 703
}