# Shell/command newgrp \<somegroup\> fails

**URL:** <https://forum.ansible.com/t/shell-command-newgrp-somegroup-fails/12968>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [June 15, 2013, 5:36pm UTC](https://forum.ansible.com/t/shell-command-newgrp-somegroup-fails/12968 "2013-06-15T17:36:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mathias\_Bogaert](https://avatars.discourse-cdn.com/v4/letter/m/df788c/32.png) [@Mathias\_Bogaert](https://forum.ansible.com/u/Mathias_Bogaert)\
**Post date:** [June 15, 2013, 5:36pm UTC](https://forum.ansible.com/t/shell-command-newgrp-somegroup-fails/12968/1 "2013-06-15T17:36:24Z")

</div>

Hi,

When running Ansible 1.2 on Ubuntu 13.04, the following stops the process:

- name: Newgrp  
command: newgrp rvm

Ansible just ‘sits’, nothing happens. When I type in the command it returns immediately.

Any idea?

Thanks,

Mathias

---

<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:** [June 15, 2013, 5:44pm UTC](https://forum.ansible.com/t/shell-command-newgrp-somegroup-fails/12968/2 "2013-06-15T17:44:01Z")

</div>

Ansible tasks should be thought of as atomic, so I’m not sure it makes sense to call rvm within ansible.

That being said, I’m not quite sure why it is keeping the connection open for you and not returning anything.

That usually happens when something goes interactive.

---

<div class="post-metadata">

**Author:** ![Seth\_Vidal](https://avatars.discourse-cdn.com/v4/letter/s/7ba0ec/32.png) [@Seth\_Vidal](https://forum.ansible.com/u/Seth_Vidal)\
**Post date:** [June 17, 2013, 4:13am UTC](https://forum.ansible.com/t/shell-command-newgrp-somegroup-fails/12968/3 "2013-06-17T04:13:27Z")

</div>

newgrp opens a new shell.

so you see it return immediately -but it's not REALLY

you just opened a new process which NEVER returns

-sv

---

<div class="post-metadata">

**Author:** ![Matt\_Bray](https://avatars.discourse-cdn.com/v4/letter/m/34f0e0/32.png) [@Matt\_Bray](https://forum.ansible.com/u/Matt_Bray)\
**Post date:** [November 6, 2013, 6:12pm UTC](https://forum.ansible.com/t/shell-command-newgrp-somegroup-fails/12968/4 "2013-11-06T18:12:17Z")

</div>

A little late to the party but you can use sg to execute a command as a member of a group without dropping into a new shell:

- name: sg!  
command: sg rvm -c “your shell command here”

I’m using that to install ruby via rvm:
