Your subject line has a question in it, but the body does not.  Is your 
question "Where are scripts executed?"  If that is your question then yes, 
you're correct, it should be the home directory of the user you logged into 
the remote server with.  You can see by doing something like 

ansible servera -m shell -a "ls"-u username

This will print the contents of the working directory when a user logs in.  
Try it with the become options to see what the result is.  You can use an 
absolute path to call a script.  Or use the "chdir" option for shell, 
something like

- hosts: collector
  become: true
  become_method: su
  become_user: root


  - name: stop eum
    shell: bin/ stop
      chdir: /opt/AppDynamics/EUEM/eum-processor/

should guarantee that you're in the correct location.

On Monday, March 12, 2018 at 4:56:20 PM UTC-4, Brian Coca wrote:
> shell executes on the remote machine, it does not look for any 
> resources 'local' to the controller, the 'working directory' depends 
> on login/become setup used on the target machine (normally 
> /home/<remote_user|become_user>. 
> But this is only important for relative paths. 
> -- 
> ---------- 
> Brian Coca 

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 post to this group, send email to
To view this discussion on the web visit
For more options, visit

Reply via email to