Shell/command newgrp <somegroup> fails

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

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.

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

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: