# using nohup with ansible & ansible-playbook --\> python error

**URL:** <https://forum.ansible.com/t/using-nohup-with-ansible-ansible-playbook-python-error/14841>\
**Category:** Ansible Project\
**Created:** [March 24, 2014, 11:20am UTC](https://forum.ansible.com/t/using-nohup-with-ansible-ansible-playbook-python-error/14841 "2014-03-24T11:20:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lee\_Van\_Steerthem](https://avatars.discourse-cdn.com/v4/letter/l/c67d28/32.png) [@Lee\_Van\_Steerthem](https://forum.ansible.com/u/Lee_Van_Steerthem)\
**Post date:** [March 24, 2014, 11:20am UTC](https://forum.ansible.com/t/using-nohup-with-ansible-ansible-playbook-python-error/14841/1 "2014-03-24T11:20:34Z")

</div>

Hello,

I want to use the command “nohup” together with ansible or ansible-playbook command so that the process would be detached form the current session.

Unfortunately it doens’t work (I think it has problems with the stdout).

w/o nohup :

**$ ansible -i hosts.rackspace -m ping proxy**  
ukproxy | success \>\> {  
“changed”: false,  
“ping”: “pong”  
}

with nohup:

**$ nohup ansible -i hosts.rackspace -m ping proxy**

nohup: ignoring input and appending output to `nohup.out’

**$ cat nohup.out**

Traceback (most recent call last):  
File “/usr/bin/ansible”, line 226, in   
(runner, results) = cli.run(options, args)  
File “/usr/bin/ansible”, line 200, in run  
results = runner.run()  
File “/usr/lib/python2.6/site-packages/ansible/runner/ **init**.py”, line 1181, in run  
results = self.\_parallel\_exec(hosts)  
File “/usr/lib/python2.6/site-packages/ansible/runner/ **init**.py”, line 1092, in \_parallel\_exec  
new\_stdin = os.fdopen(os.dup(sys.stdin.fileno()))  
OSError: [Errno 22] Invalid argument

Is there a way to solve this or maybe a workaround ?

Regards,  
Lee

---

<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:** [March 24, 2014, 3:21pm UTC](https://forum.ansible.com/t/using-nohup-with-ansible-ansible-playbook-python-error/14841/2 "2014-03-24T15:21:21Z")

</div>

What version of ansible are you using?

We fixed some dup issues previously for people calling Ansible from various programs, so am curious.

(If this still occurs in 1.5.3 or later, please file a bug on github so we can take care of it)

---

<div class="post-metadata">

**Author:** ![Lee\_Van\_Steerthem](https://avatars.discourse-cdn.com/v4/letter/l/c67d28/32.png) [@Lee\_Van\_Steerthem](https://forum.ansible.com/u/Lee_Van_Steerthem)\
**Post date:** [March 24, 2014, 6:13pm UTC](https://forum.ansible.com/t/using-nohup-with-ansible-ansible-playbook-python-error/14841/3 "2014-03-24T18:13:44Z")

</div>

I was using ansible-1.5-1

I updated to ansible (from epel-testing)

Version : 1.5.3  
Release : 1.el6

Error still occurs.

Traceback (most recent call last):  
File “/usr/bin/ansible”, line 226, in   
(runner, results) = cli.run(options, args)  
File “/usr/bin/ansible”, line 200, in run  
results = runner.run()  
File “/usr/lib/python2.6/site-packages/ansible/runner/ **init**.py”, line 1184, in run  
results = self.\_parallel\_exec(hosts)  
File “/usr/lib/python2.6/site-packages/ansible/runner/ **init**.py”, line 1095, in \_parallel\_exec  
new\_stdin = os.fdopen(os.dup(sys.stdin.fileno()))  
OSError: [Errno 22] Invalid argument

If you want I can create a bug on github.

---

<div class="post-metadata">

**Author:** ![Lee\_Van\_Steerthem](https://avatars.discourse-cdn.com/v4/letter/l/c67d28/32.png) [@Lee\_Van\_Steerthem](https://forum.ansible.com/u/Lee_Van_Steerthem)\
**Post date:** [March 24, 2014, 6:45pm UTC](https://forum.ansible.com/t/using-nohup-with-ansible-ansible-playbook-python-error/14841/4 "2014-03-24T18:45:30Z")

</div>

Created a bug on github :[https://github.com/ansible/ansible/issues/6657](https://github.com/ansible/ansible/issues/6657)
