-
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
group_vars/all not imported for implicit localhost when using dynamic inventory #6563
Comments
Ive been experiencing the same issue. Using ansible 1.6 and the ec2.py inventory from the docs, This is anoying since it means one has to run against a dummy-inventory for some tasks:
otherwise:
|
I'm seeing a similar things with a dynamic inventory script modified from the ec2.py file. I'm ending up with undefined vars during execution. I was reading elsewhere (#3566) this is due to passing an inline list instead of a file, possibly? just trying to get to the root of the issue. |
Yes, I'm seeing something probably related - I have default values for variables defined in the 'defaults' directories within roles, but I can't overwrite them using group_vars if the hosts & groups come from ec2.py. The only way is to override on the command line with '-e'. I've tried this both with the tag_name_value groups that are automatically created, and with hosts that have been put into groups using add_host. Will try to put together a minimal demo case. |
More details on what i think is a related issue at #8605 . |
That's not related. Will comment seperately on that post. |
Closing This TicketHi! We believe the above commit should resolve this question or 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! |
Thanks... I just ran into a case where I hit this bug :D And I realized I hadn't git-pulled in a bit of time. |
Seems like this issue still affects Ansible 1.7.2:
|
@danielsiwiec , I think this is intentional. The ad-hoc inventory method that you used the second time around doesn't support grouping of hosts (naturally, since it's a hack and not the standard method of specifying inventory), while Just my two cents. It might be wise to have this verified by someone who knows about this more deeply. |
Hmm. My understanding was that the dynamically specified hosts are assigned the all group, like it is with the inventory file in case you don't enclose the host with a group tag (vide my first invocation of ansible). This is also how the dynamic inventory works for the ansible-playbook command, where the host is clearly matched with the all group:
|
Could someone clarify? Given this ---
foo: bar And this playbook called ---
-
hosts: localhost
connection: local
tasks:
-
debug: msg="{{ foo }}" Should this command error out with ansible-playbook -i /dev/null test.yml It errors for me with 2.0.0 (devel 6971e92). |
@sheldonh the loading of group_vars is generally dependent on the inventory location, though it should also look relative to the current working path, so this may be a bug. Please open a new issue for this. |
by 'working path' james means adjacent to the play called:
|
Yes, what we call internally the |
@sheldonh I went ahead and fixed this already: commit 4e94bb64d82eeb8756ff54f208f001c1056a12bd Author: James Cammarata Date: Tue Jul 14 09:26:24 2015 -0400 Fix group/host var loading relative to playbook basedir |
Works for me, thanks. |
I just experience this problem on ansible-playbook 2.0.2.0 Br Mathias |
Issue Type:
Bug Report
Ansible Version:
ansible-playbook 1.5
Environment:
Ubuntu 12.04.4 LTS x64
Summary:
I think group_vars/all import is getting skipped for localhost when I specify a dynamic inventory. Here is console output of causing the issue:
Steps To Reproduce:
Here is a gist of related files: https://gist.github.com/mark-casey/9627855
Expected Results:
I would have expected the variable to be available in either use case but it wasn't.
Actual Results:
^^^
(edited to add actual template headings instead of just basing the content on template)
The text was updated successfully, but these errors were encountered: