Skip to content

Conversation

@GabrielOvie
Copy link
Contributor

Summary

Clarifies correct dict2items usage in playbook loops by showing that nested values
must be accessed via item.value.* (for example, item.value.gid) when looping over
a dict converted with dict2items.

Motivation

Addresses recurring confusion discussed in ansible/ansible#85897.

Changes

  • Updates playbook_guide/playbooks_loops.rst with a concise example and a “common mistake” note.

Notes

A prior attempt in ansible/ansible#85964 failed sanity because docs/docsite/rst/
and examples/ are obsolete in the core repo. This PR moves the content to the
correct documentation repository.

@ansible-documentation-bot ansible-documentation-bot bot added the new_contributor This PR is the first contribution by a new community member. label Oct 8, 2025
@ansible-documentation-bot
Copy link
Contributor

Thanks for your Ansible docs contribution! We talk about Ansible documentation on Matrix at #docs:ansible.im if you ever want to join us and chat about the docs! We meet on Matrix every Tuesday. See the Ansible calendar for meeting details. We welcome additions to our weekly agenda items too. You can add the dawgs-meeting tag to a forum topic to bring it up at the next meeting.

Copy link
Member

@Akasurde Akasurde left a comment

Choose a reason for hiding this comment

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

LGTM will wait for others to comment.

@Akasurde Akasurde requested a review from oraNod October 10, 2025 19:05
@samccann samccann added backport-2.17 Automatically create a backport for the stable-2.17 branch backport-2.18 Automatically create a backport for the stable-2.18 branch backport-2.19 Automatically create a backport for the stable-2.19 branch backport-2.20 Automatically create a backport for the stable-2.20 branch labels Oct 20, 2025
@samccann samccann merged commit 61ce435 into ansible:devel Oct 20, 2025
12 checks passed
@patchback
Copy link

patchback bot commented Oct 20, 2025

Backport to stable-2.17: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-2.17/61ce435c0373bfdf21b96f66e89f4b618d698694/pr-3124

Backported as #3155

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Oct 20, 2025
…to ansible#85897) (#3124)

* docs: clarify dict2items usage in loops with group module (follow-up to ansible#85897)

* docs: merge dict2items group example into existing section (per review)

* docs: replace tag_data example with nested server_configs dict example (per review)

(cherry picked from commit 61ce435)
@patchback
Copy link

patchback bot commented Oct 20, 2025

Backport to stable-2.18: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-2.18/61ce435c0373bfdf21b96f66e89f4b618d698694/pr-3124

Backported as #3156

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Oct 20, 2025
…to ansible#85897) (#3124)

* docs: clarify dict2items usage in loops with group module (follow-up to ansible#85897)

* docs: merge dict2items group example into existing section (per review)

* docs: replace tag_data example with nested server_configs dict example (per review)

(cherry picked from commit 61ce435)
@patchback
Copy link

patchback bot commented Oct 20, 2025

Backport to stable-2.19: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-2.19/61ce435c0373bfdf21b96f66e89f4b618d698694/pr-3124

Backported as #3157

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Oct 20, 2025
…to ansible#85897) (#3124)

* docs: clarify dict2items usage in loops with group module (follow-up to ansible#85897)

* docs: merge dict2items group example into existing section (per review)

* docs: replace tag_data example with nested server_configs dict example (per review)

(cherry picked from commit 61ce435)
@patchback
Copy link

patchback bot commented Oct 20, 2025

Backport to stable-2.20: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-2.20/61ce435c0373bfdf21b96f66e89f4b618d698694/pr-3124

Backported as #3158

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Oct 20, 2025
…to ansible#85897) (#3124)

* docs: clarify dict2items usage in loops with group module (follow-up to ansible#85897)

* docs: merge dict2items group example into existing section (per review)

* docs: replace tag_data example with nested server_configs dict example (per review)

(cherry picked from commit 61ce435)
samccann pushed a commit that referenced this pull request Oct 20, 2025
…to ansible#85897) (#3124) (#3155)

* docs: clarify dict2items usage in loops with group module (follow-up to ansible#85897)

* docs: merge dict2items group example into existing section (per review)

* docs: replace tag_data example with nested server_configs dict example (per review)

(cherry picked from commit 61ce435)

Co-authored-by: GABRIEL OVIE <ovieorezi@gmail.com>
samccann pushed a commit that referenced this pull request Oct 20, 2025
…to ansible#85897) (#3124) (#3156)

* docs: clarify dict2items usage in loops with group module (follow-up to ansible#85897)

* docs: merge dict2items group example into existing section (per review)

* docs: replace tag_data example with nested server_configs dict example (per review)

(cherry picked from commit 61ce435)

Co-authored-by: GABRIEL OVIE <ovieorezi@gmail.com>
samccann pushed a commit that referenced this pull request Oct 20, 2025
…to ansible#85897) (#3124) (#3157)

* docs: clarify dict2items usage in loops with group module (follow-up to ansible#85897)

* docs: merge dict2items group example into existing section (per review)

* docs: replace tag_data example with nested server_configs dict example (per review)

(cherry picked from commit 61ce435)

Co-authored-by: GABRIEL OVIE <ovieorezi@gmail.com>
samccann pushed a commit that referenced this pull request Oct 20, 2025
…to ansible#85897) (#3124) (#3158)

* docs: clarify dict2items usage in loops with group module (follow-up to ansible#85897)

* docs: merge dict2items group example into existing section (per review)

* docs: replace tag_data example with nested server_configs dict example (per review)

(cherry picked from commit 61ce435)

Co-authored-by: GABRIEL OVIE <ovieorezi@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-2.17 Automatically create a backport for the stable-2.17 branch backport-2.18 Automatically create a backport for the stable-2.18 branch backport-2.19 Automatically create a backport for the stable-2.19 branch backport-2.20 Automatically create a backport for the stable-2.20 branch new_contributor This PR is the first contribution by a new community member.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants