-
Notifications
You must be signed in to change notification settings - Fork 23.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"first_available_file" does not work with fatal message "One or more undefined variables: 'item' is undefined" #8220
Comments
I have a slightly different fix for this, to ensure that we don't re-break 7535 or anything else similar: diff --git a/lib/ansible/playbook/task.py b/lib/ansible/playbook/task.py index bd9b0d0..3865349 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 module_vars: + module_vars['item'] = '' if self.items_lookup_plugin is not None: self.module_vars['items_lookup_plugin'] = self.items_lookup_plugin If you can test that, I'll get it merged in. |
@jimi-c Thank you for your quick reply. I tried to apply your patch to release1.6.6 branch, so I confirmed it works correctly. |
@tksmd yes you're correct, that was a typo on my part. I'll correct that before I merge it in. |
Fixed and merged, thanks! |
Thanks! |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Issue Type:
Bug Report
Ansible Version:
1.6.3 - 1.6.6
Environment:
Mac OSX 10.9.4, Linux
Summary:
I use "first_available_file" on copy and template modules, but since 1.6.3 it's does not work.
When I tried "git bisect" to find a commit which made this problem, I found it:
This commit was related #7535.
And I tried to fix this problem, so I found that the following change on release1.6.6 works for me.
But I'm not sure it is correct and it has side effects.
Steps To Reproduce:
I create a following simple inventroy structure to reproduce this.
hosts
site.yml
roles/roles1/tasks/main.yml
Expected Results:
Actual Results:
The text was updated successfully, but these errors were encountered: