Looking at the code for the pause module:
if seconds is not None:
# setup the alarm handler
signal.signal(signal.SIGALRM, timeout_handler)
signal.alarm(seconds)
# show the prompt
display.display("Pausing for %d seconds" % seconds)
display.display("(ctrl+C then 'C' = continue early, ctrl+C then 'A' =
abort)\r"),
else:
display.display(prompt)
Even if you only want pause to wait some amount of time, the module still
expects STDIN to be available after prompting for ctrl+C.
So, this worked:
$ nohup ansible-playbook -vvvvvv build.yml 0</dev/null
It keeps STDIN open but provides no input.
On Tuesday, March 1, 2016 at 8:09:37 AM UTC-6, Slim Slam wrote:
>
> I guess I don't even understand why the Ansible "pause" module would care
> about stdout.
>
> J
>
> On Monday, February 29, 2016 at 5:51:08 PM UTC-6, Slim Slam wrote:
>>
>> Ansible 2.0.1
>>
>> When I ssh into a Linux server and run:
>>
>> $ ansible-playbook -vvvvvv build.yml
>>
>> it runs fine.
>>
>> But if I ssh into the Linux server and run:
>>
>> $ nohup ansible-playbook -vvvvvv build.yml
>>
>> or
>>
>> $ ansible-playbook -vvvvvv build.yml > output &
>>
>> or
>>
>> $ nohup ansible-playbook -vvvvvv build.yml > nohup.out
>>
>> or
>>
>> $ nohup ansible-playbook -vvvvvv build.yml > nohup.out 2>&1 &
>>
>>
>> it always fails on this task:
>>
>> - name: wait for something to happen
>> pause: seconds=15
>>
>> Like this:
>>
>> TASK [wait for something to happen]
>> **************************************************
>> task path: /build.yml:94
>> Pausing for 15 seconds
>> (ctrl+C then 'C' = continue early, ctrl+C then 'A' = abort)
>> An exception occurred during task execution. The full traceback is:
>> Traceback (most recent call last):
>> File "/usr/local/lib/python2.7/site-packages/ansible/executor/
>> task_executor.py", line 120, in run
>> res = self._execute()
>> File "/usr/local/lib/python2.7/site-packages/ansible/executor/
>> task_executor.py", line 418, in _execute
>> result = self._handler.run(task_vars=variables)
>> File "/usr/local/lib/python2.7/site-packages/ansible/plugins/action/
>> pause.py", line 123, in run
>> fd = self._connection._new_stdin.fileno()
>> ValueError: I/O operation on closed file
>> fatal: [localhost]: FAILED! => {"failed": true, "msg": "Unexpected
>> failure during module execution.", "stdout": ""}
>>
>> I'm pretty sure it has something to do with STDOUT not being available
>> but I'm not sure of the workaround. Anyone
>> have a suggestion?
>>
>> ===
>>
>>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/d728100d-b2d6-4950-95fd-bca11b015cf2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.