raw module - run background tasks on remote machine (using nohup and &)

33 views
Skip to first unread message

Sourav Chatterjee

unread,
Sep 30, 2016, 12:21:30 PM9/30/16
to Ansible Project
I wanted to execute shell command on remote machine but in background using nohup and & like below -

- raw: "nohup touch /tmp/hello.txt &"

It is not working. It works if it is executed without nohup and &. Any suggestions would be helpful here.

Note: I will not be able to make use of any other module as python2 is not installed on remote machine and no internet connection on remote machine.

Thanks

Brian Coca

unread,
Sep 30, 2016, 12:27:56 PM9/30/16
to ansible...@googlegroups.com
The & is a 'shellism', which raw module does not support, use 'shell' module instead, though i really recommend you set it up as a service instead.


----------
Brian Coca

Sourav Chatterjee

unread,
Sep 30, 2016, 2:01:57 PM9/30/16
to Ansible Project
Does shell module work without python2.7 installed at remote machine?

Thanks & Regards,
Sourav

Brian Coca

unread,
Sep 30, 2016, 2:18:01 PM9/30/16
to ansible...@googlegroups.com
no


--
----------
Brian Coca
Reply all
Reply to author
Forward
0 new messages