Thank you Kai for your quick answer.

However, this is happening when I use command module with args: 
executable=/bin/bash too. This kind of rules the dash theory out.
It is almost like /etc/profile is ignored in any case. 

Still, on Centos/Sles it is sourced regardless of /bin/sh or /bin/bash use 
(I know that /bin/sh is symlink to /bin/bash on those distributions)

?

On Monday, 26 March 2018 12:02:35 UTC+2, Kai Stian Olstad wrote:
>
> On 26.03.2018 11:31, Martin Simovic wrote: 
> > I am observing following behaviour using ansible on set of Ubuntu-1604, 
> > SLES-12 and CentOS-7 hosts. 
> > 
> > Environment variables, normally avaiable for login shell (/bin/bash) 
> > are 
> > not avaiable via ansible "setup" or "shell" modules for Ubuntu-16.04. 
> > Yet 
> > the same variables (defined in /etc/profile) are available for both 
> > these 
> > modules for SLES and CentOS distributions. 
> > 
> > Seems as if ansible run shell as login shell for Sles and Centos, and 
> > non-login shell for Ubuntu. This inconsistency is killing me. Anyone 
> > came 
> > across this? Possible solution? 
>
> This is normal in Debian and its derivatives. 
> Ansible is using /bin/sh that is symlink to dash. 
>
> The dash shell has to mode like most other shell, interactive and 
> non-interactive and the /etc/profile is only read in interactive shell 
> mode. 
> But since Ansible is not logging in, it just run a command it uses 
> non-interactive that file is not read. 
>
> For more information check man dash search for Invocation. 
>
> You need to use /etc/environment but remember that this file doesn't 
> support variable expansion. 
>
>
> -- 
> Kai Stian Olstad 
>

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b0a1e3f1-7760-4322-8e59-8b450240a2d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to