loop

33 views
Skip to first unread message

starflighter one

unread,
Jun 12, 2019, 8:13:58 AM6/12/19
to Ansible Project
Hi all,

how can I write with_first_found as loop?

Can you give me an example?

Thanks,
starflighter

Ryad karkar

unread,
Jun 12, 2019, 8:39:30 AM6/12/19
to Ansible Project
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,

Martin Krizek

unread,
Jun 12, 2019, 9:03:01 AM6/12/19
to ansible...@googlegroups.com
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
> --
> 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-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/217b6472-47c3-414c-ae84-a67332f179b3%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

starflighter one

unread,
Jun 13, 2019, 1:38:49 AM6/13/19
to Ansible Project
Hi Martin,

that is what I was looking for.
Thank you.

starflighter
Reply all
Reply to author
Forward
0 new messages