mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00:00
change to a more easy-to-understand example (#15863)
This commit is contained in:
@@ -556,7 +556,7 @@ Ansible by default sets the loop variable `item` for each loop, which causes the
|
||||
As of Ansible 2.1, the `loop_control` option can be used to specify the name of the variable to be used for the loop::
|
||||
|
||||
# main.yml
|
||||
- include: test.yml outer_loop="{{ outer_item }}"
|
||||
- include: inner.yml
|
||||
with_items:
|
||||
- 1
|
||||
- 2
|
||||
@@ -565,7 +565,7 @@ As of Ansible 2.1, the `loop_control` option can be used to specify the name of
|
||||
loop_var: outer_item
|
||||
|
||||
# inner.yml
|
||||
- debug: msg="outer item={{ outer_loop }} inner item={{ item }}"
|
||||
- debug: msg="outer item={{ outer_item }} inner item={{ item }}"
|
||||
with_items:
|
||||
- a
|
||||
- b
|
||||
@@ -583,7 +583,7 @@ Because `loop_control` is not available in Ansible 2.0, when using an include wi
|
||||
for `item`::
|
||||
|
||||
# main.yml
|
||||
- include: test.yml
|
||||
- include: inner.yml
|
||||
with_items:
|
||||
- 1
|
||||
- 2
|
||||
|
||||
Reference in New Issue
Block a user