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

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.

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!

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.