# New feature request: specify login shell for the shell module

**URL:** <https://forum.ansible.com/t/new-feature-request-specify-login-shell-for-the-shell-module/13864>\
**Category:** Ansible Project\
**Created:** [November 7, 2013, 6:20pm UTC](https://forum.ansible.com/t/new-feature-request-specify-login-shell-for-the-shell-module/13864 "2013-11-07T18:20:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bernat\_Rafales](https://avatars.discourse-cdn.com/v4/letter/b/a698b9/32.png) [@Bernat\_Rafales](https://forum.ansible.com/u/Bernat_Rafales)\
**Post date:** [November 7, 2013, 6:20pm UTC](https://forum.ansible.com/t/new-feature-request-specify-login-shell-for-the-shell-module/13864/1 "2013-11-07T18:20:25Z")

</div>

Hi guys,

I just started using ansible, and chatting with some of you on the freenode irc server I asked about which would be the best approach to execute shell commands on a login shell.

After some discussion, the solution was to add the flag -i to the sudo\_user parameter, something like this:

- name: rbenv | check ruby installed  
shell: rbenv versions | grep {{ ruby\_version }}  
sudo\_user: rails -i  
register: ruby\_installed  
ignore\_errors: yes

Someone in the chat suggested that maybe adding a parameter to the shell module that used a login shell instead of an interactive one could be useful as a feature.

What do you think about it?

Cheers,  
Bernat

---

<div class="post-metadata">

**Author:** ![James\_Cammarata1](https://avatars.discourse-cdn.com/v4/letter/j/d26b3c/32.png) [@James\_Cammarata1](https://forum.ansible.com/u/James_Cammarata1)\
**Post date:** [November 7, 2013, 6:32pm UTC](https://forum.ansible.com/t/new-feature-request-specify-login-shell-for-the-shell-module/13864/2 "2013-11-07T18:32:55Z")

</div>

Hi Bernat, could you please open a new issue on github for this feature request? The main ansible-project mailing list is for more general purpose questions, while github is used for bugs and feature requests. We also have ansible-devel, if you’d like to discuss the implementation of new features or have any development-related questions. Thanks!

---

<div class="post-metadata">

**Author:** ![David\_Brossard](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@David\_Brossard](https://forum.ansible.com/u/David_Brossard)\
**Post date:** [November 7, 2013, 6:37pm UTC](https://forum.ansible.com/t/new-feature-request-specify-login-shell-for-the-shell-module/13864/3 "2013-11-07T18:37:05Z")

</div>

In ansible.cfg you can also change the sudo shell… I don’t know if this is exactly what you are looking for…

# all commands executed under sudo are passed as arguments to a shell command

# This shell command defaults to /bin/sh

# Changing this helps the situation where a user is only allowed to run

# e.g. /bin/bash with sudo privileges

# executable = /bin/sh

---

<div class="post-metadata">

**Author:** ![Bernat\_Rafales](https://avatars.discourse-cdn.com/v4/letter/b/a698b9/32.png) [@Bernat\_Rafales](https://forum.ansible.com/u/Bernat_Rafales)\
**Post date:** [November 7, 2013, 8:32pm UTC](https://forum.ansible.com/t/new-feature-request-specify-login-shell-for-the-shell-module/13864/4 "2013-11-07T20:32:35Z")

</div>

I’ll do that, thanks!

El dijous 7 de novembre de 2013 18:32:55 UTC, James Cammarata va escriure:
