How to force ansible to use bash instead of sh

2,918 views
Skip to first unread message

ryanc...@gmail.com

unread,
Aug 24, 2013, 2:56:28 PM8/24/13
to ansible...@googlegroups.com
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.

 

Michael DeHaan

unread,
Aug 24, 2013, 4:10:32 PM8/24/13
to ansible...@googlegroups.com
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:





--
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-proje...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Michael DeHaan <mic...@ansibleworks.com>
CTO, AnsibleWorks, Inc.
http://www.ansibleworks.com/

Reply all
Reply to author
Forward
0 new messages