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:
Matt Martz
2019-03-26 11:07:54 -05:00
committed by GitHub
parent a5a7c7cb80
commit 6996926d89
6 changed files with 26 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ ok: [localhost] => (item=item_A)
TASK [assert] ******************************************************************
ok: [localhost] => (item=item_A) => {
"ansible_loop_var": "item",
"changed": false,
"item": "item_A",
"msg": "All assertions passed"

View File

@@ -325,3 +325,12 @@
loop_control:
extended: true
when: item == 'banana'
- name: Validate the loop_var name
assert:
that:
- ansible_loop_var == 'alvin'
loop:
- 1
loop_control:
loop_var: alvin