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.

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/306d8fa4-e907-4801-b090-08fde39daf94%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to