-
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
Playbook variables ignored when used vars_files + inventory_dir #12633
Comments
Closing This TicketHi! We believe the above commit should resolve this problem for you. This will also be included in the next major release. If you continue seeing any problems related to this issue, or if you have any further questions, please let us know by stopping by one of the two mailing lists, as appropriate:
Because this project is very active, we're unlikely to see comments made on closed tickets, but the mailing list is a great way to ask questions, or post if you don't think this particular issue is resolved. Thank you! |
Ansible 1.9.4 affected as well I like the way ansible maintainers solving the issues in... I have already found like 10 dependency cycles when you're going through the chain:
For those who are frustrated as well and want at least a silly workaround right away:
This will load vars_files as expected. |
@dene14 leaving the same comment on multiple closed issues is not helpful. If you're having a problem, please open a new issue or email one of the mailing lists to discuss it. |
jimi-c, I feel like there is no much sense to do it. I will see "Closing This Ticket" message in the end of a thread quite soon-ish :) |
We take all issues seriously. In both issues you commented on, the problem was fixed and neither reporter took issue with the fix (In fact, in #8638 akuznecov confirmed the problem was resolved), so we're not going to address this further. |
As fix for this issue is applied to devel branch and v2.0 tags, and I am still using 1.9, I had no chance to verify that. Though I use workaround with "include_vars" module in 1.9. |
@dene14 Thanks for the workaround. |
Issue Type: Bug Report
Ansible Version: 1.9.1-1.9.3
Ansible Configuration: default
Environment: Ubuntu 14.04.2 LTS
Summary:
Variables are ignored if provided through "vars_files" playbook parameter with file name containing {{inventory_dir}} magic variable.
If file name is provided as static path - no issue.
Also, if include playbook into another playbook and run - no issue.
There was similar issue #8638 fixed, and its commit is included in tags since release 1.8. Though, our scenario is very similar, but doesn't work.
Steps To Reproduce:
We have several environments defined in the repository in different folders - "dev", "staging", "production". So, depending on environment we may run playbook with "-i dev/inventory" or "-i staging/inventory" etc. So we want to use "{{ inventory_dir }}" variable to get correct path to variables file.
Test variable file (place to dev/group_vars/test.yml):
Test playbook (place to test-file-vars.yml):
Code to run:
We see that file path is validated correctly, but its variables are missing.
Static file path works well, but that doesn't allow us to parametrize environment.
When include playbook above into another playbook, everything works well.
Expected Results:
Debug message should be
Actual Results:
Getting error:
The text was updated successfully, but these errors were encountered: