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

Update loop docs to also describe register:'s value when inside loop. #20991

Merged
merged 1 commit into from
Feb 2, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion docs/docsite/rst/playbooks_loops.rst
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ That's how!
Using register with a loop
``````````````````````````

When using ``register`` with a loop, the data structure placed in the variable will contain a ``results`` attribute that is a list of all responses from the module.
After using ``register`` with a loop, the data structure placed in the variable will contain a ``results`` attribute that is a list of all responses from the module.

Here is an example of using ``register`` with ``with_items``::

Expand Down Expand Up @@ -520,6 +520,15 @@ Subsequent loops over the registered variable to inspect the results may look li
when: item.rc != 0
with_items: "{{ echo.results }}"

During iteration, the result of the current item will be placed in the variable:

- shell: echo "{{ item }}"
with_items:
- one
- two
register: echo
changed_when: echo.stdout != "one"



.. _looping_over_the_inventory:
Expand Down