-
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
Improper pathing for jinja2 includes #11931
Comments
I tried digging into this a bit and ran out of time, so I thought it was best to open an issue even though I didn't find the fix. I see that a search path is set for jinja2, but I can't figure out why it is seemingly not being searched... |
I can confirm the bug being present in latest Ansible 2.0 beta release. Here's an example test case which errors on Ansible 2.0 but works fine on Ansible 1.9.2. |
Ahh, tracked this down to the fix merged in in #9933, which incorrectly set the value on the # ansible-playbook -vv site.yml Using /etc/ansible/ansible.cfg as config file 1 plays in site.yml PLAY *************************************************************************** TASK [ansible-template-test : Generate the file from templates] **************** changed: [localhost] => {"changed": true, "checksum": "94dec40f15539fd4777b885cbe4423a4b78fb5a7", "dest": "/tmp/output-file", "gid": 0, "group": "root", "md5sum": "0bdd04bb72f25fab6582d6079a0ff9a7", "mode": "0644", "owner": "root", "secontext": "unconfined_u:object_r:user_tmp_t:s0", "size": 91, "src": "/root/.ansible/tmp/ansible-tmp-1441143378.51-9017626803498/source", "state": "file", "uid": 0} PLAY RECAP ********************************************************************* localhost : ok=1 changed=1 unreachable=0 failed=0 # cat /tmp/output-file # This file is managed by Ansible, all changes will be lost First example Second example 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! |
Fix confirmed over here as well. Thanks @jimi-c! |
Issue Type:
Ansible Version:
Ansible Configuration:
No config file found; using defaults
Environment:
N/A, running on Mac OS X
Summary:
An
include
in a jinja2 template should accept a path relative to the directory where the template file resides. This doesn't work, but a full path or a path relative to the playbook directory both do.Steps To Reproduce:
main.yml
:test.j2
:Expected Results:
Expanded template at
/tmp/foo
Actual Results:
However, if I change the
src=
setting:test.yml
:New result:
and then
/tmp/foo
has the expected contents. A full, absolute path also works.The text was updated successfully, but these errors were encountered: