diff --git a/lib/ansible/executor/process/result.py b/lib/ansible/executor/process/result.py index 7ebcd7ce87b..da06710293c 100644 --- a/lib/ansible/executor/process/result.py +++ b/lib/ansible/executor/process/result.py @@ -173,7 +173,7 @@ class ResultProcess(multiprocessing.Process): # if this task is registering facts, do that now loop_var = 'item' 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) if result._task.action == 'include_vars': for (key, value) in iteritems(result_item['ansible_facts']): diff --git a/test/integration/test_includes.yml b/test/integration/test_includes.yml index 5c191b427cc..d7303880f16 100644 --- a/test/integration/test_includes.yml +++ b/test/integration/test_includes.yml @@ -1 +1,3 @@ - include: test_includes2.yml parameter1=asdf parameter2=jkl + +- include: test_includes3.yml diff --git a/test/integration/test_includes3.yml b/test/integration/test_includes3.yml new file mode 100644 index 00000000000..012ee205688 --- /dev/null +++ b/test/integration/test_includes3.yml @@ -0,0 +1,7 @@ +--- +- hosts: localhost + tasks: + - include: test_includes4.yml + with_items: ["a"] + loop_control: + loop_var: r diff --git a/test/integration/test_includes4.yml b/test/integration/test_includes4.yml new file mode 100644 index 00000000000..bee906bdfb9 --- /dev/null +++ b/test/integration/test_includes4.yml @@ -0,0 +1,2 @@ +- set_fact: + p: 1