# find module parse return value

**URL:** <https://forum.ansible.com/t/find-module-parse-return-value/19661>\
**Category:** Ansible Project\
**Created:** [October 30, 2015, 8:16pm UTC](https://forum.ansible.com/t/find-module-parse-return-value/19661 "2015-10-30T20:16:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eugene\_Polyanichko](https://avatars.discourse-cdn.com/v4/letter/e/df788c/32.png) [@Eugene\_Polyanichko](https://forum.ansible.com/u/Eugene_Polyanichko)\
**Post date:** [October 30, 2015, 8:16pm UTC](https://forum.ansible.com/t/find-module-parse-return-value/19661/1 "2015-10-30T20:16:40Z")

</div>

Official documentation [http://docs.ansible.com/ansible/find\_module.html](http://docs.ansible.com/ansible/find_module.html) states, that main return value name is files and it’s “list of dictionaries”. Does anyone know how to parse this value? I’ve tried all possible loops, but I can’t figure out how to loop properly. I’ve read docs dozens of times, googled and nothing.

Basic code:

`

- name: Get files  
find: paths=“/etc/” patterns=“\*”  
register: find\_results

- name: Make sure line is present  
lineinfile: dest=/etc/cron.d/{{ item }} insertbefore=BOF line=“123”  
with\_items: find\_results.files  
`

This example doesn’t work, obviously, because as far as i understand, to traverse “list of dictionaries” you need to have with\_dict inside with\_items, but I don’t see a way to have nested loops of different types.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [October 30, 2015, 8:29pm UTC](https://forum.ansible.com/t/find-module-parse-return-value/19661/2 "2015-10-30T20:29:36Z")

</div>

item would be a dictionary, I'm assuming what you want is a path:

lineinfile: dest={{ item.path }}

---

<div class="post-metadata">

**Author:** ![Eugene\_Polyanichko](https://avatars.discourse-cdn.com/v4/letter/e/df788c/32.png) [@Eugene\_Polyanichko](https://forum.ansible.com/u/Eugene_Polyanichko)\
**Post date:** [October 30, 2015, 8:48pm UTC](https://forum.ansible.com/t/find-module-parse-return-value/19661/3 "2015-10-30T20:48:32Z")

</div>

Thanks a lot for reply. You saved my day. I’ve been pulling my hair off for like 4 hours and the problem was simply in wrong “dest” value, because I didn’t see my mistake and treated error output not the way it should be 🙂  
with\_items and item.path works of course
