# Restart server playbook fails on one set of targets, but not on another.

**URL:** <https://forum.ansible.com/t/restart-server-playbook-fails-on-one-set-of-targets-but-not-on-another/28344>\
**Category:** Ansible Project\
**Created:** [August 16, 2018, 7:14pm UTC](https://forum.ansible.com/t/restart-server-playbook-fails-on-one-set-of-targets-but-not-on-another/28344 "2018-08-16T19:14:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Patrick\_Hunt](https://avatars.discourse-cdn.com/v4/letter/p/c68b51/32.png) [@Patrick\_Hunt](https://forum.ansible.com/u/Patrick_Hunt)\
**Post date:** [August 16, 2018, 7:14pm UTC](https://forum.ansible.com/t/restart-server-playbook-fails-on-one-set-of-targets-but-not-on-another/28344/1 "2018-08-16T19:14:56Z")

</div>

I have the following playbook snippet

`

---

<div class="post-metadata">

**Author:** ![yaakov.kuperman](https://avatars.discourse-cdn.com/v4/letter/y/45deac/32.png) [@yaakov.kuperman](https://forum.ansible.com/u/yaakov.kuperman)\
**Post date:** [August 16, 2018, 7:18pm UTC](https://forum.ansible.com/t/restart-server-playbook-fails-on-one-set-of-targets-but-not-on-another/28344/2 "2018-08-16T19:18:47Z")

</div>

Check out [https://stackoverflow.com/questions/29955605/how-to-reboot-centos-7-with-ansible](https://stackoverflow.com/questions/29955605/how-to-reboot-centos-7-with-ansible)

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [August 16, 2018, 7:36pm UTC](https://forum.ansible.com/t/restart-server-playbook-fails-on-one-set-of-targets-but-not-on-another/28344/3 "2018-08-16T19:36:05Z")

</div>

It fails because the server shutdown too fast.  
Use  
&nbsp;&nbsp;shell: sleep 2 && reboot  
instead of your command: and it will work without issues.

---

<div class="post-metadata">

**Author:** ![yaakov.kuperman](https://avatars.discourse-cdn.com/v4/letter/y/45deac/32.png) [@yaakov.kuperman](https://forum.ansible.com/u/yaakov.kuperman)\
**Post date:** [August 16, 2018, 7:58pm UTC](https://forum.ansible.com/t/restart-server-playbook-fails-on-one-set-of-targets-but-not-on-another/28344/4 "2018-08-16T19:58:56Z")

</div>

one more thing - I’m doing something similar and I’ve found it necessary to use wait\_for: to determine that port 22 actually went down before I wait for it to come up again. I’ve also used wait\_for\_conection: to wait for it to come all the way back before I proceed.
