# playbook is pending when I execute reboot command. How to avoid the pending?

**URL:** <https://forum.ansible.com/t/playbook-is-pending-when-i-execute-reboot-command-how-to-avoid-the-pending/14205>\
**Category:** Ansible Project\
**Created:** [December 23, 2013, 9:07am UTC](https://forum.ansible.com/t/playbook-is-pending-when-i-execute-reboot-command-how-to-avoid-the-pending/14205 "2013-12-23T09:07:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rella.guo](https://avatars.discourse-cdn.com/v4/letter/r/d2c977/32.png) [@rella.guo](https://forum.ansible.com/u/rella.guo)\
**Post date:** [December 23, 2013, 9:07am UTC](https://forum.ansible.com/t/playbook-is-pending-when-i-execute-reboot-command-how-to-avoid-the-pending/14205/1 "2013-12-23T09:07:59Z")

</div>

Hello all,

My playbook process is:

1. disable selinux

2. do core tasks

3. enable selinux

4. reboot

Reboot operation is the last task. When I execute my playbook, the reboot task is pending, just like this:  
My task:

**- name: reboot**  
**command: /sbin/reboot -f**

the task result is pending:

**TASK: [reboot] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\***

How to avoid playbook pending in my case? Thank you.

BR  
Rella

---

<div class="post-metadata">

**Author:** ![Aaron\_Hunter](https://avatars.discourse-cdn.com/v4/letter/a/e19adc/32.png) [@Aaron\_Hunter](https://forum.ansible.com/u/Aaron_Hunter)\
**Post date:** [December 24, 2013, 10:09pm UTC](https://forum.ansible.com/t/playbook-is-pending-when-i-execute-reboot-command-how-to-avoid-the-pending/14205/2 "2013-12-24T22:09:17Z")

</div>

I use the wait\_for module to handle reboots. [http://www.ansibleworks.com/docs/modules.html#wait-for](http://www.ansibleworks.com/docs/modules.html#wait-for)

Mine continues after a reboot so it may not fit your needs exactly.

---

<div class="post-metadata">

**Author:** ![rella.guo](https://avatars.discourse-cdn.com/v4/letter/r/d2c977/32.png) [@rella.guo](https://forum.ansible.com/u/rella.guo)\
**Post date:** [December 26, 2013, 7:16am UTC](https://forum.ansible.com/t/playbook-is-pending-when-i-execute-reboot-command-how-to-avoid-the-pending/14205/3 "2013-12-26T07:16:37Z")

</div>

My question is reboot task is pending. If I add wait\_for task, my playbook is still pending in reboot task.  
It seems reboot task is not completed. wait\_for task doesn’t run.

My playbook:

- name: reboot  
command: /sbin/reboot -f

- name: wait reboot  
wait\_for: port=8080 delay=10

The result is:

TASK: [reboot] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

---

<div class="post-metadata">

**Author:** ![\_volanja](https://avatars.discourse-cdn.com/v4/letter/_/958977/32.png) [@\_volanja](https://forum.ansible.com/u/_volanja)\
**Post date:** [December 27, 2013, 12:05am UTC](https://forum.ansible.com/t/playbook-is-pending-when-i-execute-reboot-command-how-to-avoid-the-pending/14205/4 "2013-12-27T00:05:58Z")

</div>

Hi Rella.

Please test this code.  
Reboot is background process.  
So, not pending.

- name: reboot  
&nbsp;&nbsp;shell: sleep 2s && /sbin/reboot &

---

<div class="post-metadata">

**Author:** ![\_volanja](https://avatars.discourse-cdn.com/v4/letter/_/958977/32.png) [@\_volanja](https://forum.ansible.com/u/_volanja)\
**Post date:** [December 29, 2013, 2:16pm UTC](https://forum.ansible.com/t/playbook-is-pending-when-i-execute-reboot-command-how-to-avoid-the-pending/14205/5 "2013-12-29T14:16:59Z")

</div>

Hi Rella.

Please refer to it.  
It is old thread that talking about reboot.  
[https://groups.google.com/forum/#!msg/ansible-project/9KVUY8yBKww/FHnX6FUvrH8J](https://groups.google.com/forum/#!msg/ansible-project/9KVUY8yBKww/FHnX6FUvrH8J)

And I wrote sample-code about reboot, But it’s japanese…  
[http://qiita.com/volanja/items/d38fe0678848bae6902f#2-6](http://qiita.com/volanja/items/d38fe0678848bae6902f#2-6)

volanja

2013年12月27日金曜日 9時05分58秒 UTC+9 @volanja:

---

<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:** [December 30, 2013, 7:22pm UTC](https://forum.ansible.com/t/playbook-is-pending-when-i-execute-reboot-command-how-to-avoid-the-pending/14205/6 "2013-12-30T19:22:46Z")

</div>

Here’s how I do it:

[https://github.com/analytically/hadoop-ansible/blob/master/roles/2\_aggregated\_links/tasks/main.yml](https://github.com/analytically/hadoop-ansible/blob/master/roles/2_aggregated_links/tasks/main.yml)
