# Reboot

**URL:** <https://forum.ansible.com/t/reboot/13999>\
**Category:** Ansible Project\
**Created:** [November 25, 2013, 9:50pm UTC](https://forum.ansible.com/t/reboot/13999 "2013-11-25T21:50:15Z")\
**Posts on this page:** 11\
**Page:** 1

<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:** [November 25, 2013, 9:50pm UTC](https://forum.ansible.com/t/reboot/13999/1 "2013-11-25T21:50:15Z")

</div>

Hi,

Using Ansible 1.3, the following worked:

- name: reboot after bonding the interfaces  
shell: sleep 2s && /sbin/reboot &

- name: wait for the server to go down (reboot)  
local\_action: wait\_for host={{ inventory\_hostname }} port=22 state=stopped

- name: wait for the server to come up  
local\_action: wait\_for host={{ inventory\_hostname }} port=22 delay=30

Using Ansible 1.4, I get the following:

TASK: [2\_aggregated\_links | reboot after bonding the interfaces] \*\*\*\*\*\*\*\*\*\*\*\*\*\*  
changed: [hmaster02]  
changed: [hslave02]  
changed: [hslave01]  
changed: [hmaster01]  
changed: [hslave03]  
changed: [hslave06]  
changed: [hslave05]  
changed: [hslave04]

TASK: [2\_aggregated\_links | wait for the server to go down (reboot)] \*\*\*\*\*\*\*\*\*\*  
failed: [hmaster02] =\> {“failed”: true, “item”: “”, “parsed”: false}  
invalid output was: [sudo via ansible, key=tefdvlddkmvonwuegpwdjbzabsvrxcml] password:

failed: [hmaster01] =\> {“failed”: true, “item”: “”, “parsed”: false}  
invalid output was: [sudo via ansible, key=jussicehycjmhqzjbacrslyklbzhtduh] password:

failed: [hslave01] =\> {“failed”: true, “item”: “”, “parsed”: false}  
failed: [hslave03] =\> {“failed”: true, “item”: “”, “parsed”: false}  
invalid output was: [sudo via ansible, key=iuolakaoetpwrtjecgltrkoddrvubtoe] password:

invalid output was: [sudo via ansible, key=vyctfmxdrtgxiokmhxjnnritjltppzwb] password:

failed: [hslave02] =\> {“failed”: true, “item”: “”, “parsed”: false}  
invalid output was: [sudo via ansible, key=jkjvdcurogwhljtamwlnknknvemivzsf] password:

failed: [hslave06] =\> {“failed”: true, “item”: “”, “parsed”: false}  
invalid output was: [sudo via ansible, key=nnywazrfrszhxbdtvqyxdcppgwvzufwt] password:

failed: [hslave04] =\> {“failed”: true, “item”: “”, “parsed”: false}  
invalid output was: [sudo via ansible, key=erxobssvkstyefvsdkkbwooyiglhkpgv] password:

failed: [hslave05] =\> {“failed”: true, “item”: “”, “parsed”: false}  
invalid output was: [sudo via ansible, key=kxtdwcxkcxiexcheiksgqnlodcntcjmu] password:

What should I change in my playbook?

Thanks,

Mathias

---

<div class="post-metadata">

**Author:** ![tannerjc](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/tannerjc/32/985_2.png) [@tannerjc](https://forum.ansible.com/u/tannerjc)\
**Post date:** [November 25, 2013, 10:04pm UTC](https://forum.ansible.com/t/reboot/13999/2 "2013-11-25T22:04:02Z")

</div>

It's not immediately obvious to me what error you are pointing out. Run ansible-playbook with -vvvv and show us that output.

---

<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:** [November 26, 2013, 9:33pm UTC](https://forum.ansible.com/t/reboot/13999/3 "2013-11-26T21:33:41Z")

</div>

Here’s my debug output for local\_action: wait\_for host={{ inventory\_hostname }} port=22 state=stopped :

TASK: [2\_aggregated\_links | wait for the server to go down (reboot)] \*\*\*\*\*\*\*\*\*\*  
\<127.0.0.1\> EXEC [‘/bin/sh’, ‘-c’, ‘mkdir -p $HOME/.ansible/tmp/ansible-1385501543.62-188179043733979 && chmod a+rx $HOME/.ansible/tmp/ansible-1385501543.62-188179043733979 && echo $HOME/.ansible/tmp/ansible-1385501543.62-188179043733979’]

\<127.0.0.1\> REMOTE\_MODULE wait\_for host=hslave02 port=22 state=stopped

\<127.0.0.1\> PUT /tmp/tmpBfFpk0 TO /home/mathias/.ansible/tmp/ansible-1385501543.62-188179043733979/wait\_for  
\<127.0.0.1\> EXEC /bin/sh -c ‘sudo -k && sudo -H -S -p “[sudo via ansible, key=zmxhtofymhnomrenapokmumehaihldle] password: " -u root /bin/sh -c '”’“‘echo SUDO-SUCCESS-zmxhtofymhnomrenapokmumehaihldle; /usr/bin/python /home/mathias/.ansible/tmp/ansible-1385501543.62-188179043733979/wait\_for; rm -rf /home/mathias/.ansible/tmp/ansible-1385501543.62-188179043733979/ \>/dev/null 2\>&1’”‘"’’  
failed: [hslave02] =\> {“failed”: true, “item”: “”, “parsed”: false}  
invalid output was: [sudo via ansible, key=zmxhtofymhnomrenapokmumehaihldle] password:

Regards,

Mathias

---

<div class="post-metadata">

**Author:** ![tannerjc](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/tannerjc/32/985_2.png) [@tannerjc](https://forum.ansible.com/u/tannerjc)\
**Post date:** [November 26, 2013, 9:46pm UTC](https://forum.ansible.com/t/reboot/13999/4 "2013-11-26T21:46:43Z")

</div>

Show us your full ansible-playbook command+args and the playbook please.

---

<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:** [November 26, 2013, 9:50pm UTC](https://forum.ansible.com/t/reboot/13999/5 "2013-11-26T21:50:17Z")

</div>

Hi James,

The playbook is available here:

[https://github.com/analytically/hadoop-ansible](https://github.com/analytically/hadoop-ansible)

The roles that has the reboot here:

[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)

Thanks!

---

<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:** [November 28, 2013, 11:26pm UTC](https://forum.ansible.com/t/reboot/13999/6 "2013-11-28T23:26:29Z")

</div>

Ping?

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [December 1, 2013, 2:22pm UTC](https://forum.ansible.com/t/reboot/13999/7 "2013-12-01T14:22:06Z")

</div>

It just looks like the system didn’t take a sudo password before, you rebooted it, and now it needs a sudo password to me.

You didn’t show any of the command line options you used to execute Ansible with though, so it’s hard to say with incomplete information.

Don’t think that’s a 1.3/1.4 thing but assumptions that --sudo-user meant sudo at one point _did_ change, though I believe that was way back in 1.2.

You’ll probably have to debug a bit further to see what’s exactly going on.

Public service announcement: there is no SLA for asking for free support here, and we’re likely going to be always prioritizing larger issues affecting more users than an isolated report. If you require a SLA, our support and services guys are _excellent_, and you get an AWX license included with that. Bonus!

–Michael

---

<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 2, 2013, 7:23pm UTC](https://forum.ansible.com/t/reboot/13999/8 "2013-12-02T19:23:29Z")

</div>

Hi Michael,

The system has SSH keys installed, and never requires any passwords.

The command line options are ansible-playbook -i hosts --extra-vars “accelerate=true” site.yml.  
I’ll debug it a bit further, but this definitely worked using Ansible 1.3.

Cheers,  
Mathias

---

<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 2, 2013, 7:42pm UTC](https://forum.ansible.com/t/reboot/13999/9 "2013-12-02T19:42:45Z")

</div>

FOUND IT: if you run local\_action wait\_for with sudo: true, make sure your _local_ user doesn’t require a sudo password either by editing /etc/sudoers locally (eg mathias ALL=(ALL) NOPASSWD: ALL)!

Mathias

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [December 2, 2013, 7:44pm UTC](https://forum.ansible.com/t/reboot/13999/10 "2013-12-02T19:44:03Z")

</div>

or just add sudo:false to the local\_action, you should really not need  
superuser for the wait\_for

---

<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 2, 2013, 7:50pm UTC](https://forum.ansible.com/t/reboot/13999/11 "2013-12-02T19:50:38Z")

</div>

Ah good point, didn’t realize this was possible. Thanks!
