* Update vars for loop_control on each loop iteration (fixes #38899) (#39818)
(cherry picked from commit 01e8139d74
)
* Changelog snippet for cherry-pick of #39818
This commit is contained in:
parent
bf1436ca52
commit
8e5956a98b
2 changed files with 5 additions and 0 deletions
2
changelogs/fragments/39818-loop_control_task_vars.yaml
Normal file
2
changelogs/fragments/39818-loop_control_task_vars.yaml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- loop_control - update template vars for loop_control fields on each loop iteration (https://github.com/ansible/ansible/pull/39818).
|
|
@ -302,6 +302,9 @@ class TaskExecutor:
|
||||||
if index_var:
|
if index_var:
|
||||||
task_vars[index_var] = item_index
|
task_vars[index_var] = item_index
|
||||||
|
|
||||||
|
# Update template vars to reflect current loop iteration
|
||||||
|
templar.set_available_variables(task_vars)
|
||||||
|
|
||||||
# pause between loop iterations
|
# pause between loop iterations
|
||||||
if loop_pause and ran_once:
|
if loop_pause and ran_once:
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue