On Tuesday, 27 October 2015 16:34:10 UTC, Brian Coca wrote:
>
> I see what you mean now, but not unpredictable. Lookups are always
> relative to the role or play.
>
> Local tasks are relative to the cwd from which you execute.
>
>
> --
> Brian Coca
>
Thanks, that is excellent info.
I have not
Hi,
I have found that ansible is unpredictable in terms of determining the
current working directory on the LOCAL machine.
Invoking the same shell command as a lookup, or as a command, changes the
apparent working directory.
Is this expected behaviour?
e.g. for the playbook given below, and
just tested this against 2.0:
- hosts: localhost
gather_facts: False
vars:
third: "{{lookup('pipe', 'pwd')}}"
tasks:
- shell: pwd
register: cwd
- debug: msg={{cwd}}
- debug: msg={{lookup('pipe', 'pwd')}}
- debug: msg={{third}}
and all 3 give the same result.
On Tuesday, 27 October 2015 12:17:52 UTC, Brian Coca wrote:
>
> just tested this against 2.0:
>
> - hosts: localhost
> gather_facts: False
> vars:
> third: "{{lookup('pipe', 'pwd')}}"
> tasks:
> - shell: pwd
> register: cwd
>
> - debug: msg={{cwd}}
> - debug:
I see what you mean now, but not unpredictable. Lookups are always relative
to the role or play.
Local tasks are relative to the cwd from which you execute.
--
Brian Coca
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe