# Problem setting up the bash environment with playbook.

**URL:** <https://forum.ansible.com/t/problem-setting-up-the-bash-environment-with-playbook/15937>\
**Category:** Ansible Project\
**Created:** [August 13, 2014, 10:17pm UTC](https://forum.ansible.com/t/problem-setting-up-the-bash-environment-with-playbook/15937 "2014-08-13T22:17:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Darup\_tek](https://avatars.discourse-cdn.com/v4/letter/d/3d9bf3/32.png) [@Darup\_tek](https://forum.ansible.com/u/Darup_tek)\
**Post date:** [August 13, 2014, 10:17pm UTC](https://forum.ansible.com/t/problem-setting-up-the-bash-environment-with-playbook/15937/1 "2014-08-13T22:17:43Z")

</div>

I am trying to execute the commands over playbook.

- name: Configure open-pbis  
action: command /opt/pbis/bin/config LoginShellTemplate /bin/bash  
action: command /opt/pbis/bin/config AssumeDefaultDomain true

It is not setting the bash environment when I execute it with anisble-playbook.

[root@xxxxxxxxx~]# su - yyyy  
-sh-4.1$ env|grep SHELL  
SHELL=/bin/sh  
-sh-4.1$

Whereas, it is working absolutely fine when I execute the command " /opt/pbis/bin/config LoginShellTemplate /bin/bash"

[yyyyy@xxxxxxxxxxxxxxxxxxxx ~]$ env|grep SHELL  
SHELL=/bin/bash

Is there any thing special I have to do to make sure the command is executed as it is, it should reflect the bash as SHELL.

Thanks

---

<div class="post-metadata">

**Author:** ![Darup\_tek](https://avatars.discourse-cdn.com/v4/letter/d/3d9bf3/32.png) [@Darup\_tek](https://forum.ansible.com/u/Darup_tek)\
**Post date:** [August 14, 2014, 12:22am UTC](https://forum.ansible.com/t/problem-setting-up-the-bash-environment-with-playbook/15937/2 "2014-08-14T00:22:08Z")

</div>

It worked after I moved the command to another task section

- name: Configure open-pbis login shell  
command: ‘/opt/pbis/bin/config LoginShellTemplate /bin/bash’
- name: Configure open-pbis default domain  
command: /opt/pbis/bin/config AssumeDefaultDomain true

Can I cascade commands one after the other after from one section ?

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [August 14, 2014, 11:53am UTC](https://forum.ansible.com/t/problem-setting-up-the-bash-environment-with-playbook/15937/3 "2014-08-14T11:53:34Z")

</div>

Ansible doesn’t use the host environment files like .bashrc because it’s inconsistent if you have many hosts, it encourages centralized management.

To set environment variables, see this feature:

[http://docs.ansible.com/playbooks\_environment.html](http://docs.ansible.com/playbooks_environment.html)
