source /etc/profile is not loading

Hi All,

I am using “action: shell source /etc/profile” and at the time of playbook execution its showing changed too, but somehow i am not able to see my environment variable when i run echo $JAVA_HOME which is set under /etc/profile.
On the other side if i run source /etc/profile manually, i can see the echo $JAVA_HOME output.

Please suggest

Regards,
Pawan Kumar

Environment variables do not survive the death of the shell that sets them.

To pass an environment variable from shell to shell, you must either pass it in as a variable when invoking the second shell, or save it to a file which is sourced by the second shell.

​Regards, K.