From b21875d5a9cddafdbd8bd289be5c49c8feef093a Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Mon, 21 Jul 2014 11:01:41 -0500 Subject: [PATCH] Make sure 'item' variable is set when using first_available_file Fixes #8220 --- lib/ansible/playbook/task.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ansible/playbook/task.py b/lib/ansible/playbook/task.py index bd9b0d0d12..ecdb1df76a 100644 --- a/lib/ansible/playbook/task.py +++ b/lib/ansible/playbook/task.py @@ -257,6 +257,10 @@ class Task(object): # make first_available_file accessable to Runner code if self.first_available_file: self.module_vars['first_available_file'] = self.first_available_file + # make sure that the 'item' variable is set when using + # first_available_file (issue #8220) + if 'item' not in self.module_vars: + self.module_vars['item'] = '' if self.items_lookup_plugin is not None: self.module_vars['items_lookup_plugin'] = self.items_lookup_plugin