On Wed, 21 Jun 2023 18:56:23 -0400
ibelieve06 <[email protected]> wrote:

> ... I need to dynamically end the loop earlier (lets say 5 iterations
> instead of 10 as defined by the loop: statements).

You can't end it. You can only skip the rest. For example,

    - command: "echo {{ item }}"
      with_sequence: end=5
      register: out
      when: out.stdout|d(0)|int < 3

gives (on localhost)

  changed: [localhost] => (item=1)
  changed: [localhost] => (item=2)
  changed: [localhost] => (item=3)
  skipping: [localhost] => (item=4) 
  skipping: [localhost] => (item=5)

-- 
Vladimir Botka

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20230622010745.43089da2%40gmail.com.

Attachment: pgpg5AdA3wTuJ.pgp
Description: OpenPGP digital signature

Reply via email to