Official documentation 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.