On Tue, 20 Jun 2023 at 15:44, Алексей Глушков <[email protected]>
wrote:

> I'm executing the same script at two different hosts. Script just returns
> current working directory:
>
>   tasks:
>     - name: Get exec_path localaction
>       local_action: command pwd
>       register: res
>     - debug: var=res.stdout_lines
>
> At both hosts script is locted in /opt/test
> In one host I'm getting script location:
> TASK [debug]
> *************************************************************************************************************************************************************************************************
> ok: [single] => {
>     "res.stdout_lines": [
>         "/opt/test"
>     ]
> }
>
> On another: /root
>
> TASK [debug]
> *********************************************************************************************************************************************
> ok: [ single ] => {
>     "res.stdout_lines": [
>         "/root"
>     ]
> }
>
> Why it is so? How to make on second host run local_action from scrit
> location?
>
>
I have no idea. Can be many things, home directory of the user account
you're using, for one.
But why do you want to rely on something that is (clearly) not stable?
I would just set a directory and make sure it's there, and use that to do
what needs to be done.
It's also more according to the ansible philosophy, I think, to make things
explicit rather than depending on things that may be different (for reasons
that you don't know, in this case).

Dick

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAF8BbLa4WuSZwrhT229RPegt3jSSE3L%3DjrvALTrwL3X4LBdGpA%40mail.gmail.com.

Reply via email to