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
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)
kind regards,
Ramon de la Fuente