Still learning Ansible, so if this is a stupid question, let me know.
I'd like to know which (if any) of the typical shell init files are used 
when executing commands via the shell module. Specifically I'd like to run 
This works interactively just fine:

harald@giga:~/vagrantstuff/node/ansible$ ssh node3                  
 Debian GNU/Linux 8.5 (jessie)               built 2016-08-28 
Last login: Mon Sep 19 07:11:18 2016 from giga.lan 
harald@node3:~$ node --version 
harald@node3:~$ echo $PATH 
harald@node3:~$ echo $SHELL 
harald@node3:~$ echo $LAST 

PATH is set to include ~/node if it exists. I put this usually into 
.bashrc, but that's not working when using Ansible.
And I spend half of today to find out why.

To find out what of those files are used at all I set LAST in all of 
~/.profile, ~/.login, ~/.bash_profile, ~/.bash_login and ~/.bashrc to match 
the profile file name it's in.
E.g. in .bashrc at the bottom:

export LAST

The rather simple playbook:

- hosts: nodes
  gather_facts: false
    - name: Testing to run node
      shell: echo "SHELL=$SHELL" ; echo "PATH=$PATH" ; echo "LAST=$LAST"; 
node --version

however does not seem to honor any of those files:
fatal: [node3]: FAILED! => {"changed": true, "cmd": "echo \"SHELL=$SHELL\" 
; echo \"PATH=$PATH\"
; echo \"LAST=$LAST\"; node --version", "delta": "0:00:00.009935", "end": 
"2016-09-19 07:24:49.
008019", "failed": true, "rc": 127, "start": "2016-09-19 07:24:48.998084", 
"stderr": "/bin/bash:
node: command not found", "stdout": 
mes\nLAST=", "stdout_lines": ["SHELL=/bin/bash", 
"LAST="], "warnings": []}    
As you can see /bin/bash is used (my default shell). But LAST is not set 
and PATH is not set either which makes the "node" command  fail.
Note that I run ansible-playbook as myself, so there should be no changing 
of accounts.
If it's relevant: I use Ansible

What am I missing?


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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
For more options, visit https://groups.google.com/d/optout.

Reply via email to