Skip to content

[PoC] Add loop_control.lookup#77614

Draft
sivel wants to merge 5 commits into
ansible:develfrom
sivel:loop-control-lookup
Draft

[PoC] Add loop_control.lookup#77614
sivel wants to merge 5 commits into
ansible:develfrom
sivel:loop-control-lookup

Conversation

@sivel
Copy link
Copy Markdown
Member

@sivel sivel commented Apr 22, 2022

SUMMARY

Add loop_control.lookup to provide a transition from with_ to loop without explicit lookup call

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

lib/ansible/playbook/loop_control.py

ADDITIONAL INFORMATION

Example:

Using with_fileglob:

- debug:
    var: item
  with_fileglob:
    - /path/one/*
    - /path/two/*

Using loop + lookup:

- debug:
    var: item
  loop: '{{ q("fileglob", "/path/one/*", "/path/two/*") }}'

Using loop_control.lookup:

- debug:
    var: item
  loop:
    - /path/one/*
    - /path/two/*
  loop_control:
    lookup: fileglob

@ansibot ansibot added WIP This issue/PR is a work in progress. Nevertheless it was shared for getting input from peers. affects_2.14 feature This issue/PR relates to a feature request. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. support:community This issue/PR relates to code supported by the Ansible community. labels Apr 22, 2022
@bcoca bcoca removed the needs_triage Needs a first human triage before being processed. label Apr 26, 2022
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label May 4, 2022
@ansibot ansibot added the needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html label Jun 21, 2022
@sivel sivel added the fallible This issue/PR is a candidate for fallible label Sep 1, 2022
@sivel sivel force-pushed the loop-control-lookup branch from aa0826f to b9c5628 Compare September 1, 2022 17:43
@ansibot ansibot removed needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Sep 1, 2022
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Sep 9, 2022
@ansibot ansibot added the needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html label Sep 17, 2022
@sivel sivel force-pushed the loop-control-lookup branch from b9c5628 to b336f31 Compare September 21, 2022 14:08
@ansibot ansibot removed needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Sep 21, 2022
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Sep 29, 2022
@ansibot ansibot added the needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html label Feb 28, 2023
@sivel sivel force-pushed the loop-control-lookup branch from b336f31 to f164b82 Compare March 30, 2023 22:43
if self._task.loop_with in self._shared_loader_obj.lookup_loader:
loop_with = self._task.loop_with
elif self._task.loop_control:
loop_with = templar.template(self._task.loop_control.lookup)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This explicit templar call may be unnecessary now

@ansibot ansibot removed needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Mar 30, 2023
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Apr 12, 2023
@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html labels Jul 12, 2023
@ansibot ansibot added needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html and removed needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html labels Oct 24, 2023
@ansibot ansibot added the stale_pr This PR has not been pushed to for more than one year. label Jan 28, 2025
@sivel sivel added the unimportant_ci This PR does not need to have healthy CI status and should be ignored by the CI infra maintainers. label Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

affects_2.14 fallible This issue/PR is a candidate for fallible feature This issue/PR relates to a feature request. needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. stale_pr This PR has not been pushed to for more than one year. support:community This issue/PR relates to code supported by the Ansible community. support:core This issue/PR relates to code supported by the Ansible Engineering Team. unimportant_ci This PR does not need to have healthy CI status and should be ignored by the CI infra maintainers. WIP This issue/PR is a work in progress. Nevertheless it was shared for getting input from peers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants