I need to source the /root/.bash_profile during shell module execution thru ssh, but currently ansible only use sh, so lead to the error.
So anyway to tell ansible to load full user profile (bash)?
Thanks.
I need to source the /root/.bash_profile during shell module execution thru ssh, but currently ansible only use sh, so lead to the error.
So anyway to tell ansible to load full user profile (bash)?
Thanks.
Generally speaking, it’s better to use the environment: directive in Ansible rather than relying on a user’s shell, because you don’t know what will be in that shell script, and the point is centralized management that is consistent.
Example:
get_url: arguments go here
environment:
HTTP_PROXY: http://proxy.example.com:8080/
(this can also use variable names as references)
That all being said, you also have the executable option to the shell and command modules, as detailed here: