I have a variable set in a script file in /etc/profile.d/somescript.sh I have modified the /etc/sudoers and added "ansible" user to the sudoers file like this:
Defaults !env_reset
ansible ALL=(ALL) NOPASSWD: ALL
Why isn't the first line outputting anything ? why "sudo env" is not showing all environment variables (only partial)?
[ansible@ACEPP-LM-01 ~]$ sudo env | grep ENV
[ansible@ACEPP-LM-01 ~]$ sudo echo $ENV
PP
[ansible@ACEPP-LM-01 ~]$ echo $ENV
PP
[ansible@ACEPP-LM-01 ~]$ env | grep ENV
ENV=PP