# How to force ansible to use bash instead of sh

**URL:** <https://forum.ansible.com/t/how-to-force-ansible-to-use-bash-instead-of-sh/13358>\
**Category:** Ansible Project\
**Created:** [August 24, 2013, 6:56pm UTC](https://forum.ansible.com/t/how-to-force-ansible-to-use-bash-instead-of-sh/13358 "2013-08-24T18:56:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryanchan404](https://avatars.discourse-cdn.com/v4/letter/r/ee59a6/32.png) [@ryanchan404](https://forum.ansible.com/u/ryanchan404)\
**Post date:** [August 24, 2013, 6:56pm UTC](https://forum.ansible.com/t/how-to-force-ansible-to-use-bash-instead-of-sh/13358/1 "2013-08-24T18:56:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [August 24, 2013, 8:10pm UTC](https://forum.ansible.com/t/how-to-force-ansible-to-use-bash-instead-of-sh/13358/2 "2013-08-24T20:10:32Z")

</div>

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/](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:

[http://www.ansibleworks.com/docs/modules.html#shell](http://www.ansibleworks.com/docs/modules.html#shell)
