mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
change to a more easy-to-understand example (#15863)
This commit is contained in:
parent
10edaabed5
commit
11b3a1b8ce
1 changed files with 3 additions and 3 deletions
|
@ -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::
|
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
|
# main.yml
|
||||||
- include: test.yml outer_loop="{{ outer_item }}"
|
- include: inner.yml
|
||||||
with_items:
|
with_items:
|
||||||
- 1
|
- 1
|
||||||
- 2
|
- 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
|
loop_var: outer_item
|
||||||
|
|
||||||
# inner.yml
|
# inner.yml
|
||||||
- debug: msg="outer item={{ outer_loop }} inner item={{ item }}"
|
- debug: msg="outer item={{ outer_item }} inner item={{ item }}"
|
||||||
with_items:
|
with_items:
|
||||||
- a
|
- a
|
||||||
- b
|
- b
|
||||||
|
@ -583,7 +583,7 @@ Because `loop_control` is not available in Ansible 2.0, when using an include wi
|
||||||
for `item`::
|
for `item`::
|
||||||
|
|
||||||
# main.yml
|
# main.yml
|
||||||
- include: test.yml
|
- include: inner.yml
|
||||||
with_items:
|
with_items:
|
||||||
- 1
|
- 1
|
||||||
- 2
|
- 2
|
||||||
|
|
Loading…
Reference in a new issue