Different behavior of path resolving in lookup function in 1.5.3 and 1.5.4

80 views
Skip to first unread message

Max Romanovsky

unread,
Apr 7, 2014, 5:25:00 AM4/7/14
to ansible...@googlegroups.com
Hello,

I have a problem after migration from 1.5.3 to 1.5.4

My ansible directory is structured according to recommendations in Best Practices doc.
It is stored in /vagrant/ansible

/vagrant/ansible/group_vars/all contains directives like

fileshare_username: foo
fileshare_password
: "{{ lookup('file', '../../../credentials/common/ldap/' + fileshare_username) }}"

Password is stored in /vagrant/ansible/credentials/common/ldap/foo

/vagrant/ansible/roles/app/tasks/main.yml contains task that uses these credentials:

- name: copy smb credentials for the user
sudo: yes
sudo_user: "{{ cli_user }}"
template: src=.smbcredentials.j2 dest=~/.smbcredentials mode=0600
with_items:
- {username: "{{ fileshare_username }}", password: "{{ fileshare_password }}"}


I execute Ansible from /vagrant/ansible directory.

After upgrade to 1.5.4 I receive the following message:

/credentials/common/ldap/foo does not exist


It means that now Ansible resolves this path from the current directory, while earlier it resolved this path from the base directory of /vagrant/ansible/roles/app/tasks/main.yml file.
If I change fileshare_password value to "{{ lookup('file', 'credentials/common/ldap/' + fileshare_username) }}" or "{{ lookup('file', './credentials/common/ldap/' + fileshare_username) }}" then it starts looking for the /vagrant/ansible/roles/app/files/credentials/common/ldap/foo file. Changing value to "{{ lookup('file', './../../../credentials/common/ldap/' + fileshare_username) }}" don't help (it falls to /credentials).

I'm using self-compiled deb packages for Debian 7 without any modifications (git clone && git checkout v1.5.4 && make deb).

I haven't posted issue on github because I'm not sure if it's an issue.


Thanks in advance.

Michael DeHaan

unread,
Apr 9, 2014, 9:39:10 AM4/9/14
to ansible...@googlegroups.com
Ansible is now evaluating some things earlier, though it may need to be told to not evaluate lookup plugins at that stage.

Please file a ticket on github with steps to reproduce if you haven't done so already.

Thanks! 


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/dea62f63-d9b0-467c-80bd-9d5cbf4ccb24%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Max Romanovsky

unread,
Apr 22, 2014, 9:16:01 AM4/22/14
to ansible...@googlegroups.com
Thank you Michael!

I'll try to create a snippet with a minimal code necessary to reproduce the issue.
Then I'll post it to the github.
Reply all
Reply to author
Forward
0 new messages