# How to loop over this local\_fact in Ansible?

**URL:** <https://forum.ansible.com/t/how-to-loop-over-this-local-fact-in-ansible/26704>\
**Category:** Ansible Project\
**Created:** [February 12, 2018, 9:48am UTC](https://forum.ansible.com/t/how-to-loop-over-this-local-fact-in-ansible/26704 "2018-02-12T09:48:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [February 12, 2018, 9:48am UTC](https://forum.ansible.com/t/how-to-loop-over-this-local-fact-in-ansible/26704/1 "2018-02-12T09:48:42Z")

</div>

Its not clear to me exactly what you want the result to be after your set\_fact processing but I suggest you take a look at json\_query plugin as you might be able to use this to just pick out the bits of the result that you need. See [http://docs.ansible.com/ansible/latest/playbooks\_filters.html#json-query-filter](http://docs.ansible.com/ansible/latest/playbooks_filters.html#json-query-filter)

One of the nice things about json\_query is you can use the JMESPath examples page here: [http://jmespath.org/examples.html](http://jmespath.org/examples.html) to try out your queries (just paste your json into an input box and tinker with the query until you get results you need.

Hope this helps,

Jon
