Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] loop_control until feature #62151

Draft
wants to merge 3 commits into
base: devel
Choose a base branch
from
Draft

Conversation

bcoca
Copy link
Member

@bcoca bcoca commented Sep 11, 2019

ISSUE TYPE
  • Feature Pull Request

posisbly fixes #46203 by providing 'until for includes'

COMPONENT NAME

core

@bcoca bcoca changed the title loop_control until feature [WIP] loop_control until feature Sep 11, 2019
@ansibot
Copy link
Contributor

ansibot commented Sep 11, 2019

@ansibot ansibot added WIP affects_2.10 docs feature needs_triage support:core support:community labels Sep 11, 2019
@sivel sivel removed the needs_triage label Sep 17, 2019
@ansibot ansibot added the stale_ci label Sep 23, 2019
bcoca added 3 commits Feb 21, 2020
@ansibot ansibot removed the stale_ci label Feb 21, 2020
@ansibot ansibot added the stale_ci label Feb 29, 2020
@karstenjakobsen
Copy link
Contributor

karstenjakobsen commented Mar 14, 2020

Looks like a very nice way to handle these kind of loops!

@nodeselector
Copy link

nodeselector commented Apr 18, 2020

Not sure that these changes would fix #46203 I tested @bcoca's branch locally with this playbook:

- hosts: localhost
  gather_facts: false
  tasks:
  - name: testing block looping
    block:
      - debug:
          msg: "{{ item }}"
    loop:
      - 1
      - 2
      - 3
    loop_control:
      until: item > 2

Which yields:

ansible-playbook test/integration/targets/loop_control/block_play.yml
[WARNING]: You are running the development version of Ansible. You should only run Ansible from "devel" if you are modifying the
Ansible engine, or trying out features under development. This is a rapidly changing source of code and can become unstable at any
point.
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
ERROR! 'loop' is not a valid attribute for a Block

The error appears to be in '/Users/jeffmartin/dev/ansible/test/integration/targets/loop_control/block_play.yml': line 4, column 5, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  tasks:
  - name: testing block looping
    ^ here

Am I missing something?

@nodeselector
Copy link

nodeselector commented Apr 18, 2020

Ah I see what I was missing, this fix would only apply to includes not block. This works great:

- hosts: localhost
  gather_facts: false
  tasks:
  - name: testing inlcude looping
    include_tasks: some_tasks.yml
    loop:
      - 1
      - 2
      - 3
    loop_control:
      until: item > 2

@abdulrabbani00
Copy link

abdulrabbani00 commented Oct 29, 2020

Can you guys please fix this, the people are really hoping for this feature.

@ansibot ansibot added pre_azp and removed stale_ci labels Dec 8, 2020
@pini-gh
Copy link

pini-gh commented Jun 19, 2021

I've had some success using when as described here. This is not exactly an until or break feature, but it can be used for the same purpose.

@ansibot ansibot added the needs_rebase label Jun 23, 2022
@bcoca bcoca marked this pull request as draft Jul 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects_2.10 docs feature has_issue needs_rebase pre_azp support:community support:core WIP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants