Merge pull request #16538 from amenonsen/loop_control-dot

Use loop_control.loop_var directly
This commit is contained in:
Abhijit Menon-Sen 2016-07-01 07:16:21 +05:30 committed by GitHub
commit 26755b3a62
4 changed files with 12 additions and 1 deletions

View file

@ -173,7 +173,7 @@ class ResultProcess(multiprocessing.Process):
# if this task is registering facts, do that now # if this task is registering facts, do that now
loop_var = 'item' loop_var = 'item'
if result._task.loop_control: if result._task.loop_control:
loop_var = result._task.loop_control.get('loop_var') or 'item' loop_var = result._task.loop_control.loop_var or 'item'
item = result_item.get(loop_var, None) item = result_item.get(loop_var, None)
if result._task.action == 'include_vars': if result._task.action == 'include_vars':
for (key, value) in iteritems(result_item['ansible_facts']): for (key, value) in iteritems(result_item['ansible_facts']):

View file

@ -1 +1,3 @@
- include: test_includes2.yml parameter1=asdf parameter2=jkl - include: test_includes2.yml parameter1=asdf parameter2=jkl
- include: test_includes3.yml

View file

@ -0,0 +1,7 @@
---
- hosts: localhost
tasks:
- include: test_includes4.yml
with_items: ["a"]
loop_control:
loop_var: r

View file

@ -0,0 +1,2 @@
- set_fact:
p: 1