loop

Hi all,

how can I write with_first_found as loop?

I can’t find an example at https://docs.ansible.com/ansible/devel/porting_guides/porting_guide_2.5.html#migrating-from-with-x-to-loop

Can you give me an example?

Thanks,
starflighter

Hi,

You can see one exemple for loop :

- name: "with_list -> loop"
  debug:
    msg: "{{ item }}"
  loop:
    - my first word
    - my second word

When i execut this task, the result is :

[item=1] => my first word
[item=2] => my second word

Do you understand ?

Regards,

Hello,

you can find an example of using `first_found` with `loop` here:
https://docs.ansible.com/ansible/latest/user_guide/playbooks_conditionals.html#selecting-files-and-templates-based-on-variables.

Thanks,
Martin

Hi Martin,

that is what I was looking for.
Thank you.

starflighter