# has the active path of the pipe lookup\_plugin changed

**URL:** <https://forum.ansible.com/t/has-the-active-path-of-the-pipe-lookup-plugin-changed/15496>\
**Category:** Ansible Developer\
**Created:** [June 18, 2014, 9:43pm UTC](https://forum.ansible.com/t/has-the-active-path-of-the-pipe-lookup-plugin-changed/15496 "2014-06-18T21:43:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ramon](https://avatars.discourse-cdn.com/v4/letter/r/34f0e0/32.png) [@ramon](https://forum.ansible.com/u/ramon)\
**Post date:** [June 18, 2014, 9:43pm UTC](https://forum.ansible.com/t/has-the-active-path-of-the-pipe-lookup-plugin-changed/15496/1 "2014-06-18T21:43:06Z")

</div>

Hey all,

I might have missed a changelog but I can’t seem to find this change documented:

When setting a variable to the value “{{ lookup(‘pipe’, ‘pwd’) }}” in the root of a playbook, and then using that variable inside a role, the working directory for the command has changed between ansible versions 1.5.5 and 1.6.0

In 1.5.5: it’s the location of the playbook  
In 1.6.0: it’s the “tasks” folder of the role, or - if the role contains a “files” folder, it’s that.

Here’s a test repo:  
[https://github.com/ramondelafuente/ansible-lookup-plugin-tests](https://github.com/ramondelafuente/ansible-lookup-plugin-tests)

Condensed results for the command “ansible --version && ansible-playbook -i testing/hosts testing/playbook.yml”:

**ansible 1.5.5**  
TASK: [test\_role\_with\_files | task\_in\_role\_wit\_files\_variable] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
“local\_file\_name”: “/Users/fzz/Projects/future500/vps-provisioning/testing”  
TASK: [test\_role\_with\_files | task\_in\_role\_with\_files\_lookup\_plugin] \*\*\*\*\*\*\*\*\*\*  
“msg”: “/Users/fzz/Projects/future500/vps-provisioning/testing/test\_role\_with\_files/files”  
TASK: [test\_role\_without\_files | task\_in\_role\_without\_files\_variable] \*\*\*\*\*\*\*\*\*  
“local\_file\_name”: “/Users/fzz/Projects/future500/vps-provisioning/testing”  
TASK: [test\_role\_without\_files | task\_in\_role\_without\_files\_lookup\_plugin] \*\*\*\*  
“msg”: “/Users/fzz/Projects/future500/vps-provisioning/testing/test\_role\_without\_files/tasks”  
TASK: [task\_in\_playbook\_with\_variable] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
“local\_file\_name”: “/Users/fzz/Projects/future500/vps-provisioning/testing”  
TASK: [task\_in\_playbook\_with\_lookup\_plugin] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
“msg”: “/Users/fzz/Projects/future500/vps-provisioning/testing”

**ansible 1.6.1**  
TASK: [test\_role\_with\_files | task\_in\_role\_wit\_files\_variable] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
“local\_file\_name”: “/Users/fzz/Projects/future500/vps-provisioning/testing/test\_role\_with\_files/files”  
TASK: [test\_role\_with\_files | task\_in\_role\_with\_files\_lookup\_plugin] \*\*\*\*\*\*\*\*\*\*  
“msg”: “/Users/fzz/Projects/future500/vps-provisioning/testing/test\_role\_with\_files/files”  
TASK: [test\_role\_without\_files | task\_in\_role\_without\_files\_variable] \*\*\*\*\*\*\*\*\*  
“local\_file\_name”: “/Users/fzz/Projects/future500/vps-provisioning/testing/test\_role\_without\_files/tasks”  
TASK: [test\_role\_without\_files | task\_in\_role\_without\_files\_lookup\_plugin] \*\*\*\*  
“msg”: “/Users/fzz/Projects/future500/vps-provisioning/testing/test\_role\_without\_files/tasks”  
TASK: [task\_in\_playbook\_with\_variable] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
“local\_file\_name”: “/Users/fzz/Projects/future500/vps-provisioning/testing”  
TASK: [task\_in\_playbook\_with\_lookup\_plugin] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
“msg”: “/Users/fzz/Projects/future500/vps-provisioning/testing”

The question is: Was this intended?  
(sparked by this stackoverflow question [http://stackoverflow.com/a/24252727/601704](http://stackoverflow.com/a/24252727/601704))

kind regards,

Ramon de la Fuente

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [June 19, 2014, 5:33am UTC](https://forum.ansible.com/t/has-the-active-path-of-the-pipe-lookup-plugin-changed/15496/2 "2014-06-19T05:33:17Z")

</div>

The pipes lookup itself does not appear to have changed, the call to Popen still uses cwd=self.basedir, which has not changed in 2 years as far as I can tell from git logs.

However, based on your output above it does appear that the basedir value has changed somewhat. I’m not sure if that’s a bug, because for a role it would make more sense for it to be looking in the current directory of the tasks/main.yml than the playbook directory itself. Feel free to open a github issue in regards to this and we can dig into it.

---

<div class="post-metadata">

**Author:** ![ramon](https://avatars.discourse-cdn.com/v4/letter/r/34f0e0/32.png) [@ramon](https://forum.ansible.com/u/ramon)\
**Post date:** [June 19, 2014, 9:38am UTC](https://forum.ansible.com/t/has-the-active-path-of-the-pipe-lookup-plugin-changed/15496/3 "2014-06-19T09:38:40Z")

</div>

Yeah , like I said - I could not find the change in the change log or in code (did not look beyond the plugin either).

I find the new behaviour slightly counter-intuitive because I cannot use the pipe lookup plugin to fill a path variable in a pre-task; it’s value will be different when run in the actual role. On the other hand, the plugins each have their purpose and like you said - it might make more sense for them to work within context.

Long story short: I’m not sure it’s a bug either - I was just wondering if this was intentional or a side-effect. I’ve put my findings out there, for me there’s no need to open an issue.

kind regards,

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [June 19, 2014, 12:42pm UTC](https://forum.ansible.com/t/has-the-active-path-of-the-pipe-lookup-plugin-changed/15496/4 "2014-06-19T12:42:42Z")

</div>

Definitely a side effect. Go ahead and open an issue and we can at least bisect it to find out the responsible commit.

---

<div class="post-metadata">

**Author:** ![ramon](https://avatars.discourse-cdn.com/v4/letter/r/34f0e0/32.png) [@ramon](https://forum.ansible.com/u/ramon)\
**Post date:** [June 19, 2014, 1:39pm UTC](https://forum.ansible.com/t/has-the-active-path-of-the-pipe-lookup-plugin-changed/15496/5 "2014-06-19T13:39:40Z")

</div>

Done: [https://github.com/ansible/ansible/issues/7834](https://github.com/ansible/ansible/issues/7834)

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [June 19, 2014, 9:47pm UTC](https://forum.ansible.com/t/has-the-active-path-of-the-pipe-lookup-plugin-changed/15496/6 "2014-06-19T21:47:00Z")

</div>

Using the roles basedir seems correct to me and we’ve closed this one out.
