mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 06:10:22 -07:00
Expose loop_control.loop_var as ansible_loop_var (#54240)
* Expose the loop_var as ansible_loop_var * Add docs * fix assert test * Indicate version added
This commit is contained in:
parent
a5a7c7cb80
commit
6996926d89
6 changed files with 26 additions and 0 deletions
|
@ -400,6 +400,14 @@ Variable Description
|
|||
loop_control:
|
||||
extended: yes
|
||||
|
||||
.. versionadded:: 2.8
|
||||
|
||||
As of Ansible 2.8 you can get the name of the value provided to ``loop_control.loop_var`` using the ``ansible_loop_var`` variable
|
||||
|
||||
For role authors, writing roles that allow loops, instead of dictating the required ``loop_var`` value, you can gather the value via::
|
||||
|
||||
"{{ lookup('vars', ansible_loop_var) }}"
|
||||
|
||||
.. _migrating_to_loop:
|
||||
|
||||
Migrating from with_X to loop
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue